private void CreateCell() { //Ex.Logger.Log("CreateCell", mCreateWithUpdate, Scheduler.GetTimer()); // Value value = this.mValues[this.mKeepIndex]; // GameObject cell = HS_ViewManager.UIAddChild(mGridContent.gameObject, mCellPrefab); // cell.name = "CellPrefab"; // mValues[mKeepIndex].cell = cell.GetComponent<HS_UIListViewCell>(); // if (this.onInit != null) // { // this.onInit(this, value.cell, value.data); // } GameObject cell = null; int index = mKeepIndex % mCellCount;// 0 % 6 = 0 | 7 % 6 = 1 Value value = this.mValues[index]; if (mCellCount > cellCount || value.cell == null) { cell = HS_ViewManager.UIAddChild(mGridContent.gameObject, mCellPrefab); } else { cell = value.cell.gameObject; } cell.name = "CellPrefab"; value.cell = cell.GetComponent <HS_UIListViewCell>(); if (this.onInit != null) { this.onInit(this, value.cell, value.data); } }
protected override void OnStarted() { scheduler.Timeout(() => { HS_ViewManager.Open <UILoginView>(); HS_ViewManager.Close <UILogoView>(); }, 2); }
public void ChangeState(RipeState state) { if (HS_ViewManager.Get <UIHomeView>().CurrentHumidity == 0f) { D.Log("湿度为 0"); return; } _MushroomsRipeState.ChangeState(state); }
protected override void OnStarted() { base.OnStarted(); scheduler.Timeout(() => { HS_ViewManager.Open <UIHomeView>(); HS_ViewManager.Close <UILoginView>(); }, 1); }
private void CreateCell() { //Ex.Logger.Log("CreateCell", mCreateWithUpdate, Scheduler.GetTimer()); Value value = this.mValues[this.mKeepIndex]; GameObject cell = HS_ViewManager.UIAddChild(mGridContent.gameObject, mCellPrefab); cell.name = "CellPrefab"; mValues[mKeepIndex].cell = cell.GetComponent <HS_UIListViewCell>(); if (this.onInit != null) { this.onInit(this, value.cell, value.data); } }
public void UpdateLayout() { string gridCellPath = HS_Path.CombinePath("Assets", "SubAssets", "Res", "Prefabs", "UIListCell"); if (mCellPrefab == null) { Debug.Log(mCellPrefabName); if (mCellPrefabName != "") { string cellPrefabPath = HS_Path.CombinePath(gridCellPath, mCellPrefabName + ".prefab"); Debug.Log(cellPrefabPath); GameObject prefab = UnityEditor.AssetDatabase.LoadAssetAtPath(cellPrefabPath, typeof(GameObject)) as GameObject; mCellPrefab = HS_ViewManager.UIAddChild(mGridContent.gameObject, prefab); mCellPrefab.name = "CellPrefab"; } } if (mGridContent == null) { Debug.LogError("Not specified GridContent"); return; } if (mCellPrefab == null) { Debug.LogError("Not specified CellPrefab"); return; } for (int i = mGridContent.transform.childCount - 1; i >= 0; i--) { Transform t = mGridContent.transform.GetChild(i); if (t.gameObject != mCellPrefab) { DestroyImmediate(t.gameObject); } } int count = mCellCount - mGridContent.transform.childCount; for (int i = 0; i < count; i++) { GameObject cell = HS_ViewManager.UIAddChild(mGridContent.gameObject, mCellPrefab); cell.name = "Cell(clone)"; } }
void Start() { //HS_ViewManager.Open<UILogoView>(); HS_ViewManager.Open <UITestView>(); //StartCoroutine(Load()); }