本文整理汇总了C#中UIGrid类的典型用法代码示例。如果您正苦于以下问题:C# UIGrid类的具体用法?C# UIGrid怎么用?C# UIGrid使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UIGrid类属于命名空间,在下文中一共展示了UIGrid类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Awake
public override void Awake()
{
base.Awake();
_uiTable = GetComponent<UITable>();
_uiGrid = GetComponent<UIGrid>();
_itemTemplate = gameObject.GetComponent<NguiListItemTemplate>();
}
示例2: CrystalPtPanel
public CrystalPtPanel(EnDZPlayer playerFlag_)
{
m_text = new AuxLabel();
m_mpGrid = new UIGrid();
m_playerSide = playerFlag_;
m_crystalList = new MList<CrystalPtItem>();
}
示例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;
}
示例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;
}
}
示例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);
}
示例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);
}
示例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);
}
});
}
示例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);
}
示例9: Start
// Use this for initialization
void Start()
{
meetingListPage = GameObject.Find("mainPannel").GetComponent<UIPanel>();
grid = meetingListPage.GetComponentInChildren<UIGrid>();
this.initFakeData();
}
示例10: Awake
private void Awake()
{
panelCached = ScrollView.GetComponentInChildren<UIPanel>();
gridCached = ScrollView.GetComponentInChildren<UIGrid>();
ScrollView.onDragFinished += OnDragFinished;
restrictWithinPanelCached = ScrollView.restrictWithinPanel;
}
示例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>();
}
示例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;
}
示例13: Start
void Start()
{
bagGirid = this.FindComponent<UIGrid>(bagGiridPath);
bagItemPrefab = Resources.Load(bagItemPath) as GameObject;
StartCoroutine(LoadBagItems());
}
示例14: Start
void Start()
{
grid = gameObject.GetComponent<UIGrid>();
Vector3 newPos = new Vector3(Screen.width * relativePosition.x, Screen.height * relativePosition.y, 0f);
transform.localPosition = newPos;
}
示例15: Update
private void Update()
{
grid = gameObject.GetComponentInParent<UIGrid> ();
if (grid)
{
//dragDropContainer.reparentTarget = grid.transform;
}
}