本文整理汇总了C#中UIGrid类的典型用法代码示例。如果您正苦于以下问题:C# UIGrid类的具体用法?C# UIGrid怎么用?C# UIGrid使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UIGrid类属于命名空间,在下文中一共展示了UIGrid类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Awake
public override void Awake()
{
base.Awake();
_uiTable = GetComponent<UITable>();
_uiGrid = GetComponent<UIGrid>();
_itemTemplate = gameObject.GetComponent<NguiListItemTemplate>();
}
开发者ID:NateFromSpace,项目名称:Sandbox,代码行数:7,代码来源:NguiItemsSourceBinding.cs
示例2: CrystalPtPanel
public CrystalPtPanel(EnDZPlayer playerFlag_)
{
m_text = new AuxLabel();
m_mpGrid = new UIGrid();
m_playerSide = playerFlag_;
m_crystalList = new MList<CrystalPtItem>();
}
开发者ID:zhutaorun,项目名称:unitygame,代码行数:7,代码来源:CrystalPtPanel.cs
示例3: addDragComponent
public GameObject addDragComponent(GameObject item, UIGrid mGrid, Vector3 itemSize)
{
GameObject _item = item;
//spawn in grid
//Debug.Log("====================> bjy: _item:"+_item+"|"+"mGrid:"+mGrid);
_item.transform.parent = mGrid.transform;
//_item.transform.localScale = Vector3.one;
_item.transform.localScale = itemSize;
//add drag object
_item.AddComponent<UIDragObject>();
_item.GetComponent<UIDragObject>().target = mGrid.transform;
_item.GetComponent<UIDragObject>().restrictWithinPanel = true;
if ( mGrid.arrangement == UIGrid.Arrangement.Horizontal )
{
_item.GetComponent<UIDragObject>().scale = Slide_Horizontal;
}
else if ( mGrid.arrangement == UIGrid.Arrangement.Vertical )
{
_item.GetComponent<UIDragObject>().scale = Slide_Vertical;
}
//add box collider
_item.AddComponent<BoxCollider>();
_item.GetComponent<BoxCollider>().size = itemSize;
//add button scale
_item.AddComponent<NvUIListItem>();
return _item;
}
开发者ID:aminebenali,项目名称:dancing-cell-code,代码行数:29,代码来源:NvListItemBuilder.cs
示例4: findWidget
public void findWidget()
{
if (EnDZPlayer.ePlayerSelf == m_playerSide)
{
m_text = new AuxLabel(UtilApi.GoFindChildByPObjAndName(CVSceneDZPath.SelfMpText));
}
else
{
m_text = new AuxLabel(UtilApi.GoFindChildByPObjAndName(CVSceneDZPath.EnemyMpText));
}
if (EnDZPlayer.ePlayerSelf == m_playerSide)
{
m_mpGrid = new UIGrid();
m_mpGrid.setGameObject(UtilApi.GoFindChildByPObjAndName(CVSceneDZPath.SelfMpList));
m_mpGrid.maxPerLine = 1;
m_mpGrid.cellWidth = 0.5f;
m_mpGrid.cellHeight = 0.5f;
}
else
{
m_mpGrid = new UIGrid();
m_mpGrid.setGameObject(UtilApi.GoFindChildByPObjAndName(CVSceneDZPath.EnemyMpList));
m_mpGrid.maxPerLine = 10;
m_mpGrid.cellWidth = 0.5f;
m_mpGrid.cellHeight = 0.5f;
}
}
开发者ID:zhutaorun,项目名称:unitygame,代码行数:28,代码来源:CrystalPtPanel.cs
示例5: Recenter
/// <summary>
/// Recenter the draggable list on the center-most child.
/// </summary>
public void Recenter()
{
var trans = transform;
if (trans.childCount == 0) return;
if (uiGrid == null)
{
uiGrid = GetComponent<UIGrid>();
}
if (mScrollView == null)
{
mScrollView = NGUITools.FindInParents<UIScrollView>(gameObject);
if (mScrollView == null)
{
Debug.LogWarning(GetType() + " requires " + typeof(UIScrollView) + " on a parent object in order to work", this);
enabled = false;
return;
}
mScrollView.onDragFinished = OnDragFinished;
if (mScrollView.horizontalScrollBar != null)
mScrollView.horizontalScrollBar.onDragFinished = OnDragFinished;
if (mScrollView.verticalScrollBar != null)
mScrollView.verticalScrollBar.onDragFinished = OnDragFinished;
}
if (mScrollView.panel == null) return;
// Calculate the panel's center in world coordinates
var corners = mScrollView.panel.worldCorners;
var panelCenter = (corners[2] + corners[0]) * 0.5f;
// Offset this value by the momentum
var pickingPoint = panelCenter - mScrollView.currentMomentum * (mScrollView.momentumAmount * 0.1f);
mScrollView.currentMomentum = Vector3.zero;
var visibleItems = 0;
if (mScrollView.movement == UIScrollView.Movement.Horizontal)
{
visibleItems = Mathf.FloorToInt(mScrollView.panel.width / uiGrid.cellWidth);
}
if (mScrollView.movement == UIScrollView.Movement.Vertical)
{
visibleItems = Mathf.FloorToInt(mScrollView.panel.height / uiGrid.cellHeight);
}
var maxPerLine = uiGrid.maxPerLine != 0
? uiGrid.maxPerLine
: (uiGrid.arrangement == UIGrid.Arrangement.Horizontal
? Mathf.FloorToInt(mScrollView.panel.width / uiGrid.cellWidth)
: Mathf.FloorToInt(mScrollView.panel.height / uiGrid.cellHeight));
if(uiGrid.transform.childCount <= maxPerLine * visibleItems)
{
return;
}
var closestPos = visibleItems % 2 == 0
? FindClosestForEven(pickingPoint, maxPerLine, visibleItems / 2)
: FindClosestForOdd(pickingPoint, maxPerLine, visibleItems / 2);
CenterOnPos(closestPos);
}
开发者ID:wuxin0602,项目名称:Nothing,代码行数:64,代码来源:CustomCenterOnChild.cs
示例6: PrimaryGridBtn
public void PrimaryGridBtn(){
GridBase = GetComponent<UIGrid> ();
MaxPerLine = GridBase.maxPerLine;
DefaultShowIndexs = new int[]{0, 1, 2, 3, 4, 5};
ShowGridBtnObjs = new List<GameObject> ();
PrimaryXML ();
grids = SeriaOrDeSeria.DeSerialzeXML (path, typeof(GridBtn[])) as GridBtn[];
GridBtnObjs = new GameObject[grids.Length];
for (int i = 0; i < grids.Length; i++) {
GameObject ob = Instantiate(GridBtnPrefab) as GameObject;
ob.transform.GetChild(0).GetComponent<UITexture>().mainTexture = Resources.Load<Texture>(grids[i].ImgPath);
ob.name = GridBtnPrefab.name + i.ToString();
GridBtnObjs[i] = ob;
ob.transform.SetParent(DownPanelRepository.transform);
ob.transform.position = Vector3.zero;
ob.transform.localScale = Vector3.one;
}
GridBtnObjs[0].GetComponent<MyUIEventIndex>().Listener += Test1;
GridBtnObjs[1].GetComponent<MyUIEventIndex>().Listener += Test2;
GridBtnObjs[2].GetComponent<MyUIEventIndex>().Listener += Test3;
GridBtnObjs[3].GetComponent<MyUIEventIndex>().Listener += Test4;
GridBtnObjs[4].GetComponent<MyUIEventIndex>().Listener += Test5;
GridBtnObjs[5].GetComponent<MyUIEventIndex>().Listener += Test6;
GridBtnObjs[6].GetComponent<MyUIEventIndex>().Listener += Test7;
GridBtnObjs[7].GetComponent<MyUIEventIndex>().Listener += Test8;
GridBtnObjs[8].GetComponent<MyUIEventIndex>().Listener += Test9;
GridBtnObjs[9].GetComponent<MyUIEventIndex>().Listener += Test10;
AdjustShowGrids(0, true);
}
开发者ID:JorLinWang2,项目名称:FVR,代码行数:31,代码来源:DownPanelControl.cs
示例7: IntilizationBlocksWaitForSecond
public static void IntilizationBlocksWaitForSecond(UIGrid grid, int number, GameObject itemPre, List<GameObject> list, float time, float time2, Action<List<GameObject>> callback = null)
{
for (int i = 0; i < number; i++)
{
GameObject gameO = (GameObject)GameObject.Instantiate(itemPre);
gameO.transform.parent = grid.transform;
gameO.transform.localScale = Vector3.one;
gameO.transform.localPosition = Vector3.one;
gameO.name = i.ToString();
list.Add(gameO);
}
Utility.instance.WaitForSecs(time, () =>
{
if(grid != null)
grid.Reposition();
});
Utility.instance.WaitForSecs(time2, () =>
{
for (int i = 0; i < list.Count; i++)
{
if (list[i] != null)
list[i].SetActive(true);
}
});
}
开发者ID:xiaozhuzhaoge,项目名称:Universal-Space,代码行数:26,代码来源:UISystem.cs
示例8: OnInit
public override void OnInit()
{
base.OnInit();
m_ObjOptionalRoot = FindChild("OptionalRoot");
m_ObjOptionalTemplate = FindChild("OptionalTextureTemplate");
m_OptionalMap = new Dictionary<string, RegularityOptionalElement>();
m_UICamera = WindowManager.Instance.GetUICamera();
m_ObjWinRoot = FindChild("Win");
m_ObjLoseRoot = FindChild("Lose");
m_PopList = FindChildComponent<UIPopupList>("PopupList");
m_ButtonRoot = FindChild("ButtonRoot");
m_Grid = m_ObjOptionalRoot.GetComponent<UIGrid>();
m_LabelLeftTime = FindChildComponent<UILabel>("Label_LeftTime");
m_LabelLeftCount = FindChildComponent<UILabel>("Label_LeftCount");
m_FlowerList = new List<GameObject>();
for (int i = 0; i < 3; ++i)
{
var obj = FindChild("Flower"+i);
m_FlowerList.Add(obj);
}
AddChildElementClickEvent(OnClickReset, "UIButton_ResetElem");
AddChildElementClickEvent(OnClickResetById, "UIButton_Reset");
AddChildElementClickEvent(OnClickBack, "UIButton_BackElem");
AddChildElementClickEvent(OnClickBack, "UIButton_Back");
AddChildElementClickEvent(OnClickBack, "Button_Exit");
m_ObjLoseRoot.SetActive(false);
m_ObjWinRoot.SetActive(false);
m_ButtonRoot.SetActive(false);
}
开发者ID:Blizzardx,项目名称:ClientFrameWork,代码行数:33,代码来源:UIWindowRegularity.cs
示例9: Start
// Use this for initialization
void Start()
{
meetingListPage = GameObject.Find("mainPannel").GetComponent<UIPanel>();
grid = meetingListPage.GetComponentInChildren<UIGrid>();
this.initFakeData();
}
开发者ID:henrybit,项目名称:GroupJoinUs,代码行数:8,代码来源:MeetingList.cs
示例10: Awake
private void Awake()
{
panelCached = ScrollView.GetComponentInChildren<UIPanel>();
gridCached = ScrollView.GetComponentInChildren<UIGrid>();
ScrollView.onDragFinished += OnDragFinished;
restrictWithinPanelCached = ScrollView.restrictWithinPanel;
}
开发者ID:wuxin0602,项目名称:Nothing,代码行数:7,代码来源:ScrollBackWhenNotFull.cs
示例11: Awake
/// <summary>
/// Used to initial some varibles.
/// </summary>
private void Awake()
{
okLis = UIEventListener.Get(transform.Find("OK").gameObject);
cancelLis = UIEventListener.Get(transform.Find("Cancel").gameObject);
costCoins = Utils.FindChild(transform, "CostValue").GetComponent<UILabel>();
grid = GetComponentInChildren<UIGrid>();
}
开发者ID:wuxin0602,项目名称:Nothing,代码行数:10,代码来源:BuyBackDialogWindow.cs
示例12: Awake
// Use this for initialization
void Awake()
{
mailItems = transform.Find("MailItems").GetComponent<UIGrid>();
okLis = UIEventListener.Get(transform.Find("OK").gameObject);
okLis.onClick = OnOk;
dimmerLis = UIEventListener.Get(transform.Find("Dimmer").gameObject);
dimmerLis.onClick = OnDimmer;
}
开发者ID:wuxin0602,项目名称:Nothing,代码行数:9,代码来源:UIMailReceiveWindow.cs
示例13: Start
void Start()
{
bagGirid = this.FindComponent<UIGrid>(bagGiridPath);
bagItemPrefab = Resources.Load(bagItemPath) as GameObject;
StartCoroutine(LoadBagItems());
}
开发者ID:HawardLocke,项目名称:MadLand,代码行数:8,代码来源:LevelPanel.cs
示例14: Start
void Start()
{
grid = gameObject.GetComponent<UIGrid>();
Vector3 newPos = new Vector3(Screen.width * relativePosition.x, Screen.height * relativePosition.y, 0f);
transform.localPosition = newPos;
}
开发者ID:jcabe4,项目名称:Reignite,代码行数:8,代码来源:ResizeGrid.cs
示例15: Update
private void Update()
{
grid = gameObject.GetComponentInParent<UIGrid> ();
if (grid)
{
//dragDropContainer.reparentTarget = grid.transform;
}
}
开发者ID:tghocutt,项目名称:Dotflow,代码行数:8,代码来源:BoosterItemBehavior.cs
示例16: MedicApp
public MedicApp(int type, SmartPhone phone, int consumeRate, Entity owner = null, string Title = "Medic App v1.0")
: base(type, phone, consumeRate, owner, Title)
{
UIGrid statusEffects = new UIGrid(Width: SmartPhone.SCREEN_RECT.Width, GridColumns: 1, CursorType: CursorType.Cursor, MarginBottom: 20);
PageContent.AddElement(statusEffects);
PageContent.AddElement(CreateSwitchAppButton("Main Menu", phone.GetMainMenu()));
}
开发者ID:EoinF,项目名称:TheOtherDarkWorld,代码行数:9,代码来源:MedicApp.cs
示例17: Start
// Use this for initialization
void Start()
{
Debug.Log("MeetingList create");
meetingGrid = meetingGridGameObject.GetComponentInChildren<UIGrid>();
//meetingWarningGrid = meetingWarningGridGameObject.GetComponentInChildren<UIGrid>();
destroyChilds(meetingGridGameObject);
destroyChilds(meetingWarningGridGameObject);
initMeetingData();
}
开发者ID:henrybit,项目名称:GroupJoinUs,代码行数:10,代码来源:MeetingListNew.cs
示例18: CreateObjects
private void CreateObjects()
{
this.mTipBg = base.transform.Find("itemTipBg").GetComponent<UISprite>();
GameObject gameObject = this.mTipBg.transform.Find("closeBtn").gameObject;
UIEventListener expr_3C = UIEventListener.Get(gameObject);
expr_3C.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(expr_3C.onClick, new UIEventListener.VoidDelegate(this.OnCloseBtnClick));
this.mSchoolName = this.mTipBg.transform.Find("guildName").GetComponent<UILabel>();
this.mItemGrid = this.mTipBg.transform.Find("contents").GetComponent<UIGrid>();
}
开发者ID:floatyears,项目名称:Decrypt,代码行数:9,代码来源:GuildSchoolItemTip.cs
示例19: CreateObjects
private void CreateObjects()
{
this.mScrollView = GameUITools.FindGameObject("Panel", base.gameObject).GetComponent<UIScrollView>();
this.mContent = GameUITools.FindGameObject("Content", this.mScrollView.gameObject).GetComponent<UIGrid>();
this.mPass = GameUITools.RegisterClickEvent("Pass", new UIEventListener.VoidDelegate(this.OnPassClick), base.gameObject);
this.mCancel = GameUITools.RegisterClickEvent("Cancel", new UIEventListener.VoidDelegate(this.OnCancelClick), base.gameObject);
this.mOK = GameUITools.RegisterClickEvent("OK", new UIEventListener.VoidDelegate(this.OnOKClick), base.gameObject);
this.mPassCost = GameUITools.FindUILabel("Cost", this.mPass);
}
开发者ID:floatyears,项目名称:Decrypt,代码行数:9,代码来源:MagicLoveFarmLayer.cs
示例20: Awake
// Use this for initialization
private void Awake()
{
selCount = Utils.FindChild(transform, "SelValue").GetComponent<UILabel>();
soulCount = Utils.FindChild(transform, "SoulValue").GetComponent<UILabel>();
scHeroList = HeroModelLocator.Instance.SCHeroList;
hero = HeroModelLocator.Instance.HeroTemplates;
sellLis = UIEventListener.Get(transform.Find("Button-Sell").gameObject);
grid = transform.Find("Container/Grid").GetComponent<UIGrid>();
}
开发者ID:wuxin0602,项目名称:Nothing,代码行数:10,代码来源:UISellHeroHandler.cs
注:本文中的UIGrid类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论