public void RefreshHeroIcon() { if (Grid.transform.childCount > 0 && Grid.transform.childCount < playerData.GetInstance().herodataList.Count) { for (int i = Grid.transform.childCount - 1; i >= 0; i--) { if (Grid.GetChild(i) != null) { DestroyImmediate(Grid.GetChild(i).gameObject); } } } GameObject item = null; for (int i = 0; i < playerData.GetInstance().herodataList.Count; i++) { item = NGUITools.AddChild(Grid.gameObject, ItemHeroDetail); if (item.GetComponent <ItemHeroIcon>()) { icon = item.GetComponent <ItemHeroIcon>(); if (heroIcon.ContainsKey(playerData.GetInstance().herodataList[i].id)) { heroIcon.Remove(playerData.GetInstance().herodataList[i].id); } heroIcon.Add(playerData.GetInstance().herodataList[i].id, icon); icon.RefreshInfo(playerData.GetInstance().herodataList[i]); } } }
/// <summary> /// Loads the record. /// </summary> /// <returns>The record.</returns> IEnumerator LoadRecord() { Logger.Instance.WriteLog("加载巡逻方案的数据"); if (VideoPatrolPlanInfos == null) { VideoPatrolPlanInfos = new List <VideoPatrolPlanInfo> (); } VideoPatrolPlanGrid.transform.DestroyChildren(); VideoPatrolPlanInfos.Clear(); VideoPatrolPlanDao vppDao = new VideoPatrolPlanDao(); vppDao.Select001(); VideoPatrolPlanInfos = vppDao.Result; for (int i = 0; i < VideoPatrolPlanInfos.Count; i++) { AddItemToVideoPatrolPlanGrid(VideoPatrolPlanInfos[i]); } if (VideoPatrolPlanInfos.Count > 0) { ShowPlanDetail(VideoPatrolPlanGrid.GetChild(0).gameObject); } if (VideoPatrolPlanInfos.Count == 0) { VideoPatrolPlanEditPanel.SetActive(false); } yield return(null); }
public void AddHistroyRecord(ref HistroyRecordData data) { if (mUIGrid.GetChildList().Count >= MAX_RECORD_SUM) { DespawnHistroyRecord(mUIGrid.GetChild(0)); } SpawnHistroyRecord(ref data); }
public void CountAchievementFinish() { countachievement = 0; for (int i = 0; i < grid.GetChildList().Count; i++) { if (grid.GetChild(i).GetComponent <ItemAchievement>().finish) { countachievement++; } } Debug.Log("Dem nhiem vu hoan thanh " + countachievement); }
void OnChannelConnected(string group_name) { ChatLine chat = new ChatLine(Localization.Format("ConnectChannel", group_name)); var line = ChatLinePrefabManager.GetNewObject <PopupChatLine>(ChatLineGrid.transform, Vector3.zero); line.Init(chat, null, null); if (ChatLineGrid.GetChildList().Count > ChatLineManager.Instance.ChattingMaxLine) { ChatLinePrefabManager.Free(ChatLineGrid.GetChild(ChatLineGrid.GetChildList().Count - 1).gameObject); } OnDragFinished(true); }
public void ClearItemGrid() { for (int i = itemGrid.transform.childCount - 1; i >= 0; i--) { DestroyImmediate(itemGrid.GetChild(i).gameObject); } }
public void ShowSpecialGang(List <int[]> data, Action <GameObject> callback) { OnClickSpecialGangEvent = callback; Show(true); int childLenth = _grid.transform.childCount; while (childLenth > 0) { DestroyImmediate(_grid.transform.GetChild(0).gameObject); childLenth--; } foreach (int[] t in data) { var aa = new List <int>(t); CreatMahjongData(aa); } for (int i = 0; i < _grid.GetChildList().Count; i++) { _grid.GetChild(i).name = i.ToString(); } _grid.transform.localPosition = new Vector3(-110, 0, 0); _grid.cellWidth = 320; _grid.repositionNow = true; _paiBg.width = (int)(_grid.GetChildList().Count *_grid.cellWidth); }
protected override void CreateCustomGUI() { GameObject prefab = ResourceLoadManager.Instance.LoadPrefab("Prefab/GUI/Ultimate21ScoreBoard") as GameObject; scoreBoardPanel = CommonFunction.InstantiateObject(prefab, GameSystem.Instance.mClient.mUIManager.m_uiRootBasePanel.transform); UIGrid boardGrid = scoreBoardPanel.transform.FindChild("Pane/ScoreBoards").GetComponent <UIGrid>(); scoreBoards[0] = boardGrid.GetChild(0).gameObject; scoreBoards[1] = CommonFunction.InstantiateObject(scoreBoards[0], boardGrid.transform); scoreBoards[1].name = "1"; scoreBoards[2] = CommonFunction.InstantiateObject(scoreBoards[0], boardGrid.transform); scoreBoards[2].name = "2"; boardGrid.Reposition(); Transform timerNode = scoreBoardPanel.transform.FindChild("Pane/TimerBoard"); prefab = ResourceLoadManager.Instance.LoadPrefab("Prefab/GUI/TimerBoard") as GameObject; timerBoard = CommonFunction.InstantiateObject(prefab, timerNode).GetComponent <TimerBoard>(); for (int i = 0; i < 3; ++i) { scoreBoards[i].transform.FindChild("Name").GetComponent <UILabel>().text = players[i].m_name; } prefab = ResourceLoadManager.Instance.LoadPrefab("Prefab/GUI/ButtonBack") as GameObject; GameObject backButton = CommonFunction.InstantiateObject(prefab, scoreBoardPanel.transform); UIEventListener.Get(backButton).onClick = OnBack; }
/// <summary> /// 加载预设位的信息 /// </summary> void LoadPresetPosition() { Logger.Instance.WriteLog("加载预设位的信息"); BtnConfirm.SetActive(false); PresetPosItems = new List <GameObject> (); PresetPositionDao ppDao = new PresetPositionDao(); ppDao.Select001(cameraId.ToString()); PresetPosInfos = ppDao.Result; if (PresetPosInfos.Count <= 0) { CreatePresetPosition(); ppDao.Select001(cameraId.ToString()); PresetPosInfos = ppDao.Result; } for (int i = 0; i < PresetPosInfos.Count; i++) { GameObject go = PresetPosItemContainer.GetChild(i).gameObject; UIEventListener.Get(go).onClick = OnPresetPosItemSelected; PresetPosItems.Add(go); } defaultSprite = PresetPosItems [0].GetComponent <UIButton> ().normalSprite; OnPresetPosItemSelected(PresetPosItems[0]); }
/// <summary> /// 隐藏GRID下所有子项 /// </summary> /// <param name="grid">UIGrid</param> public static void HideItem(this UIGrid grid) { if (grid == null) { return; } int len = grid.transform.childCount; for (int i = 0; i < len; i++) { if (grid.GetChild(i) == null) { continue; } grid.GetChild(i).gameObject.SetActive(false); } }
//从数据库加载疏散预案数据 IEnumerator LoadData() { Logger.Instance.WriteLog("从数据库加载疏散预案数据"); EvacuationPlanDao epDao = new EvacuationPlanDao(); List <EvacuateArea> eAreaList = epDao.Select001(); foreach (var area in eAreaList) { AddItemToEvacuateAreaItemGrid(area); } if (eAreaList.Count > 0) { EvacuateAreaDevicePanel.SetActive(true); EvacuateAreaListGrid.GetChild(0).GetComponent <EditedEvacuateAreaListItem>().Selected(); } yield return(null); }
bool InitItem() { GameObject item = null; ItemEmbattleList itemEmba = null; herodatalist = new List <HeroData>(); if (playerData.GetInstance().herodataList.Count <= 0) { Debug.Log("herodataList count is 0"); return(false); } if (itemEmbattleGrid.transform.childCount > 0) { for (int i = itemEmbattleGrid.transform.childCount - 1; i >= 0; i--) { if (itemEmbattleGrid.GetChild(i) != null) { DestroyImmediate(itemEmbattleGrid.GetChild(i).gameObject); } } itemEmbattles.Clear(); } herodatalist = playerData.GetInstance().herodataList; herodatalist.Sort(new HeroDataComparer()); for (int i = 0; i < herodatalist.Count; i++) { item = NGUITools.AddChild(itemEmbattleGrid.gameObject, itemEmbattle); if (item.GetComponent <ItemEmbattleList>()) { itemEmba = item.GetComponent <ItemEmbattleList>(); if (itemEmbattles.ContainsKey(herodatalist[i].id)) { itemEmbattles.Remove(herodatalist[i].id); } itemEmbattles.Add(herodatalist[i].id, itemEmba); itemEmba.RefreshItemUI(herodatalist[i]); if (null == itemEmba.OnClickItem) { itemEmba.OnClickItem = OnIECallBack; } } } return(true); }
void Start() { hasGift = false; bgMain = transform.FindChild("Main"); bgBlack = transform.FindChild("Black"); grid = bgMain.FindChild("Scroll View").FindChild("Grid").GetComponent <UIGrid>(); //Debug.Log(DateTime.Today.DayOfYear + "------------------"); //Check ngay bat dau choi trong he thong neu chua co thi luu ngay hien tai vao data if (!PlayerPrefs.HasKey(key_start_day)) { PlayerPrefs.SetInt(key_start_day, DateTime.Today.DayOfYear); PlayerPrefs.SetInt(key_start_year, DateTime.Today.Year); } //Lay ngay ban dau da luu trong he thong int day_start = PlayerPrefs.GetInt(key_start_day); int year_start = PlayerPrefs.GetInt(key_start_year); //Lay ngay hien tai trong nam int day_current = DateTime.Today.DayOfYear; int year_current = DateTime.Today.Year; int day_open_gift = 1; //So sanh nam if (year_current > year_start) { //Neu nam hien tai > nam bat dau => mo het dailygift day_open_gift = 12; } else if (year_current == year_start) { day_open_gift = day_current - day_start + 1; } if (day_open_gift > 12) { day_open_gift = 12; } //Check data cua daily gift da co chua, neu chua se cho vao da ta if (!PlayerPrefs.HasKey(key_data_daily_gift)) { PlayerPrefsX.SetBoolArray(key_data_daily_gift, new bool[12]); } bool[] dataDailyGift = PlayerPrefsX.GetBoolArray(key_data_daily_gift); for (int i = 0; i < day_open_gift; i++) { grid.GetChild(i).GetComponent <ItemDailyGift>().SetData(dataDailyGift[i]); if (dataDailyGift[i] == false) { hasGift = true; } } if (DialogDailyGift.hasGift && LoadingStartMenu.showGift) { Debug.Log("SHOW gift "); LoadingStartMenu.showGift = false; ShowDialog(); } }
public override void ShowDialog(DialogAbs.CallBackShowDialog callback = null) { if (!Show) { Show = true; bgMain = transform.FindChild("Main"); bgBlack = transform.FindChild("Black"); bgMain.gameObject.SetActive(true); bgBlack.gameObject.SetActive(true); bgMain.FindChild("Logo").FindChild("Title").GetComponent <UILabel>().text = MissionControl.Language["DAILY_GIFT"]; for (int i = 1; i <= grid.GetChildList().Count; i++) { grid.GetChild(i - 1).FindChild("Day").GetComponent <UILabel>().text = MissionControl.Language["Day"] + " " + i; grid.GetChild(i - 1).FindChild("ButtonGet").FindChild("Label").GetComponent <UILabel>().text = MissionControl.Language["Get"]; } LeanTween.scale(bgMain.gameObject, new Vector3(1, 1, 1), 0.4f).setUseEstimatedTime(true).setEase(LeanTweenType.easeOutBack).setUseEstimatedTime(true);; } }
public void Reset() { while (Items.transform.childCount > 0) { DestroyImmediate(Items.GetChild(0).gameObject); } Items.repositionNow = true; scrollBar.value = 0; }
static int GetChild(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 2); UIGrid obj = (UIGrid)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UIGrid"); int arg0 = (int)LuaScriptMgr.GetNumber(L, 2); Transform o = obj.GetChild(arg0); LuaScriptMgr.Push(L, o); return(1); }
static int GetChild(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 2); UIGrid obj = LuaScriptMgr.GetNetObject <UIGrid>(L, 1); int arg0 = (int)LuaScriptMgr.GetNumber(L, 2); Transform o = obj.GetChild(arg0); LuaScriptMgr.Push(L, o); return(1); }
private static int GetChild(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 2); UIGrid uIGrid = (UIGrid)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UIGrid"); int index = (int)LuaScriptMgr.GetNumber(L, 2); Transform child = uIGrid.GetChild(index); LuaScriptMgr.Push(L, child); return(1); }
public void ResetPosition() { while (_infoGrid.transform.childCount > 0) { DestroyImmediate(_infoGrid.GetChild(0).gameObject); } SpringPanel.Begin(ScrollView.gameObject, Vector3.zero, 10000); _curPageNum = 1; itemIndex = 0; }
public void updateItem(int index, AiPoint point) { Transform item = mGrid.GetChild(index); if (item == null || point == null) { return; } item.transform.FindChild("UILabel_SpeedScale").GetComponent <UILabel>().text = point.speedScale.ToString(); item.transform.FindChild("UILabel_Rchange").GetComponent <UILabel>().text = point.rChange.ToString(); item.transform.FindChild("UILabel_During").GetComponent <UILabel>().text = point.time.ToString(); }
private void SelectDefault() { if (PlayerPrefs.HasKey("teaSelectIndex")) { var teaSelectIndex = int.Parse(PlayerPrefs.GetString("teaSelectIndex")); FriendGroupGrid.GetChild(teaSelectIndex).GetComponent <UIToggle>().startsActive = true; } else { FriendGroupGrid.transform.GetChild(0).GetComponent <UIToggle>().startsActive = true; } }
//从数据库加载疏散预案数据 IEnumerator LoadData() { yield return(new WaitForEndOfFrame()); EvacuationPlanDao epDao = new EvacuationPlanDao(); List <EvacuatePlan> ePlanList = epDao.Select003(); foreach (var plan in ePlanList) { AddItemToEvacuatePlanItemGrid(plan); } if (ePlanList.Count > 0) { EvacuateAreaOfPlanPanel.SetActive(true); EvacuatePlanItemGrid.GetChild(0).GetComponent <EditedEvacuatePlanListItem>().Selected(); } else { EvacuateAreaOfPlanPanel.SetActive(false); } yield return(null); }
static public int GetChild(IntPtr l) { try { UIGrid self = (UIGrid)checkSelf(l); System.Int32 a1; checkType(l, 2, out a1); var ret = self.GetChild(a1); pushValue(l, true); pushValue(l, ret); return(2); } catch (Exception e) { return(error(l, e)); } }
static int GetChild(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); UIGrid obj = (UIGrid)ToLua.CheckObject(L, 1, typeof(UIGrid)); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); UnityEngine.Transform o = obj.GetChild(arg0); ToLua.Push(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public void NewList(JArray jArray) { // 모든 정보 초기화 while (Items.transform.childCount > 0) { DestroyImmediate(Items.GetChild(0).gameObject); } foreach (string data in jArray) { UILabel newitem = Instantiate(label, Items.transform); newitem.text = data; } Items.GetComponent <UIWidget>().height = (int)(Items.cellHeight * jArray.Count); Items.repositionNow = true; UIScrollBar.value = 0; }
/// <summary> /// 重新选择赋值该行 /// </summary> public void Reselect() { int childCount = PokerParent.transform.childCount; for (int i = 0; i < childCount; i++) { PokerParent.GetChild(i).gameObject.SetActive(false); } SetLineState(false); var cards = _lineInfo.SelectedCards; foreach (var card in cards) { card.gameObject.SetActive(true); } _lineInfo.Reset(); }
private static int GetChild(IntPtr L) { int result; try { ToLua.CheckArgsCount(L, 2); UIGrid uIGrid = (UIGrid)ToLua.CheckObject(L, 1, typeof(UIGrid)); int index = (int)LuaDLL.luaL_checknumber(L, 2); Transform child = uIGrid.GetChild(index); ToLua.Push(L, child); result = 1; } catch (Exception e) { result = LuaDLL.toluaL_exception(L, e, null); } return(result); }
public static int GetChild(IntPtr l) { int result; try { UIGrid uIGrid = (UIGrid)LuaObject.checkSelf(l); int index; LuaObject.checkType(l, 2, out index); Transform child = uIGrid.GetChild(index); LuaObject.pushValue(l, true); LuaObject.pushValue(l, child); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
// Update is called once per frame void Update() { // Debug.Log ("COUNT "+ PhotonNetwork.GetRoomList().Length); if (PhotonNetwork.insideLobby) { Debug.Log("Inside a Lobby"); Debug.Log("roomsize" + PhotonNetwork.GetRoomList().Length.ToString()); Debug.Log("gridsize " + gridPanel.GetChildList().size); if (PhotonNetwork.GetRoomList().Length == 0 && gridPanel.GetChildList().size == 1) { editBug = true; if (editBug == true) { NGUITools.Destroy(gridPanel.GetChild(0).gameObject); editBug = false; } } } }
/// <summary> /// 初始化回放数据 /// </summary> /// <param name="datas"></param> public void Init(List <RecordData> datas) { while (_infoGrid.transform.childCount > 0) { DestroyImmediate(_infoGrid.GetChild(0).gameObject); } ResetPosition(); RecordItem item; foreach (var data in datas) { item = NGUITools.AddChild(_infoGrid.gameObject, Item).GetComponent <RecordItem>(); item.gameObject.SetActive(true); item.Init(data); } if (_nullTexture != null) { _nullTexture.SetActive(datas.Count <= 0); } _infoGrid.repositionNow = true; }