public void UpdateBookBtns() { foreach (UIButton s in stroBtns) { if (grid.GetIndex(s.transform) != -1) { leftGrid.RemoveChild(s.transform); s.transform.parent = this.gameObject.transform; } s.gameObject.SetActive(false); } foreach (UIButton b in bookBtns) { b.transform.parent = leftGrid.transform; b.gameObject.SetActive(true); b.transform.localScale = Vector3.one; } leftGrid.Reposition(); UpdateList(HelpType.HT_Money); for (int i = 0; i < stroBtns.Count; i++) { stroBtns[i].isEnabled = true; } for (int i = 0; i < bookBtns.Count; i++) { bookBtns[i].isEnabled = true; } moneeyBtn.isEnabled = false; }
public void UpdataBlackList() { if (!leftPane.gameObject.activeSelf) { return; } foreach (GameObject o in friendCellList) { friendGrild.RemoveChild(o.transform); o.transform.parent = null; GameObject.Destroy(o); } friendCellList.Clear(); friendGrild.RemoveChild(blackBtn.transform); blackBtn.transform.parent = null; friendGrild.AddChild(blackBtn.transform, 1); //blackBtn.transform.parent = friendGrild.transform; blackBtn.SetActive(true); blackBtn.transform.localScale = Vector3.one; UIManager.SetButtonEventHandler(blackBtn.gameObject, EnumButtonEvent.OnClick, OnInitBlack, 0, 0); int indx = friendGrild.GetIndex(blackBtn.transform); foreach (COM_ContactInfo f in FriendSystem.Instance().blacks_) { GameObject obj = Object.Instantiate(friendCell.gameObject) as GameObject; obj.SetActive(true); FriendItem cellUI = obj.GetComponent <FriendItem>(); cellUI.ContactInfo = f; if (FriendSystem.Instance().ChatDict.ContainsKey(f.name_)) { cellUI.red.gameObject.SetActive(true); } else { cellUI.red.gameObject.SetActive(false); } cellUI.IsBlack(true); cellUI.delCallBack = OnCellDelBlack; friendGrild.AddChild(obj.transform, ++indx); friendCellList.Add(obj); obj.transform.localScale = Vector3.one; } friendGrild.Reposition(); }
/// <summary> /// 进度条定位到指定节点位置 /// </summary> /// <param name="item"></param> public void Locate(string value, bool isFoldMenu = true) { TreeMenuItem clickItem = nodes[value]; currentItem = clickItem; List <TreeMenuItem> items = clickItem.getParents(); if (!isFoldMenu) { clickItem.foldAllChildMenuNode(true); } //foreach (TreeMenuItem item in nodes.Values) //{ // if(!items.Contains(item)) // item.allFoldNode(); //} //if (items.Count > 0) //{ // for (int i = items.Count - 1; i >= 0; i--) // { // items[i].foldMenuNode(false); // } //} menuClick(clickItem.gameObject, true, isFoldMenu); //menuClick(clickItem.gameObject, value, false); //clickItem.foldMenuNode(false); int count = treeGrid.GetChildList().Count; float progress = (float)treeGrid.GetIndex(currentItem.transform) / count; scrollBar.value = progress; scrollBarChange(); treeGrid.repositionNow = true; treeGrid.Reposition(); }
void OnUnCollect(ButtonScript obj, object args, int param1, int param2) { UIGrid grid = transform.parent.GetComponent <UIGrid>(); AuctionHouseSystem.RemoveCollection(grid.GetIndex(transform) - 1); grid.RemoveChild(transform); gameObject.SetActive(false); }
static int GetIndex(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 2); UIGrid obj = (UIGrid)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UIGrid"); Transform arg0 = (Transform)LuaScriptMgr.GetUnityObject(L, 2, typeof(Transform)); int o = obj.GetIndex(arg0); LuaScriptMgr.Push(L, o); return(1); }
static int GetIndex(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 2); UIGrid obj = LuaScriptMgr.GetNetObject <UIGrid>(L, 1); Transform arg0 = LuaScriptMgr.GetNetObject <Transform>(L, 2); int o = obj.GetIndex(arg0); LuaScriptMgr.Push(L, o); return(1); }
static public int GetIndex(IntPtr l) { try { UIGrid self = (UIGrid)checkSelf(l); UnityEngine.Transform a1; checkType(l, 2, out a1); var ret = self.GetIndex(a1); pushValue(l, true); pushValue(l, ret); return(2); } catch (Exception e) { return(error(l, e)); } }
static int GetIndex(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); UIGrid obj = (UIGrid)ToLua.CheckObject(L, 1, typeof(UIGrid)); UnityEngine.Transform arg0 = (UnityEngine.Transform)ToLua.CheckUnityObject(L, 2, typeof(UnityEngine.Transform)); int o = obj.GetIndex(arg0); LuaDLL.lua_pushinteger(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
private static int GetIndex(IntPtr L) { int result; try { ToLua.CheckArgsCount(L, 2); UIGrid uIGrid = (UIGrid)ToLua.CheckObject(L, 1, typeof(UIGrid)); Transform trans = (Transform)ToLua.CheckUnityObject(L, 2, typeof(Transform)); int index = uIGrid.GetIndex(trans); LuaDLL.lua_pushinteger(L, index); result = 1; } catch (Exception e) { result = LuaDLL.toluaL_exception(L, e, null); } return(result); }
void OtherRotate(Transform tOther, int dir, int midIndex) { if (tOther != null) { Vector3 targEuler = Vector3.zero; TweenScale.Begin(tOther.gameObject, tweenTime, otherScale).method = UITweener.Method.EaseOut; // Vector3 fromEuler = Vector3.zero; if (myGrid != null) { if (midIndex - myGrid.GetIndex(tOther) >= 1) { targEuler = Vector3.down * farEuler; } } if (dir < 0) { TweenRotation tR = tOther.GetComponent <TweenRotation>(); if (tR != null) { tR.from = targEuler; targEuler = Vector3.down * farEuler; tR.to = targEuler; } else { tR = tOther.gameObject.AddComponent <TweenRotation>(); tR.from = targEuler; targEuler = Vector3.down * farEuler; tR.to = targEuler; } tR.duration = tweenTime; tR.method = UITweener.Method.EaseOut; tR.ResetToBeginning(); tR.Play(); } else { targEuler = Vector3.up * farEuler; Quaternion targetQ = Quaternion.Euler(targEuler); TweenRotation.Begin(tOther.gameObject, tweenTime, targetQ).method = UITweener.Method.EaseOut; } } }
void InitQuestKindItem() { foreach (GameObject c in chindCellList) { maingrid.RemoveChild(c.transform); c.transform.parent = null; c.gameObject.SetActive(false); chindCellPoolList.Add(c); } chindCellList.Clear(); maingrid.Reposition(); int index = maingrid.GetIndex(QuestKindsObj[0].transform); List <QuestData> qdas = QuestSystem.GetQuestDataForQuestKind(QuestKinds[0]); List <QuestData> qds = new List <QuestData> (); Profession pro = Profession.get((JobType)GamePlayer.Instance.GetIprop(PropertyType.PT_Profession), GamePlayer.Instance.GetIprop(PropertyType.PT_ProfessionLevel)); for (int i = 0; i < qdas.Count; i++) { if (qdas[i].questKind_ == QuestKind.QK_Profession) { if (qdas[i].JobLevel_ != 1) { if (qdas[i].jobtype_ == (int)GamePlayer.Instance.GetIprop(PropertyType.PT_Profession)) { if (qdas[i].JobLevel_ - GamePlayer.Instance.GetIprop(PropertyType.PT_ProfessionLevel) == 1) { qds.Add(qdas[i]); } } } } } for (int i = 0; i < qds.Count; i++) { if (QuestSystem.IsFDailyQuest()) { if (qds[i].questKind_ == QuestKind.QK_Daily) { continue; } } GameObject objCell = null; if (chindCellPoolList.Count > 0) { objCell = chindCellPoolList[0]; chindCellPoolList.Remove(objCell); } else { objCell = Object.Instantiate(item) as GameObject; } UIManager.SetButtonEventHandler(objCell, EnumButtonEvent.OnClick, OnClickChindItem, qds[i].id_, 0); maingrid.AddChild(objCell.transform, ++index); objCell.SetActive(true); objCell.transform.localScale = Vector3.one; AcceptableCell acell = objCell.GetComponent <AcceptableCell>(); acell.Qdata = qds[i]; chindCellList.Add(objCell); maingrid.repositionNow = true; } if (chindCellList.Count > 0) { // AcceptableCell acell = chindCellList[0].GetComponent <AcceptableCell>(); acell.stateSp.gameObject.SetActive(true); acell.statetwoSp.gameObject.SetActive(true); curCell = acell; TaskUI tui = taskInfoObj.GetComponent <TaskUI> (); tui.ShowTaskIonf(qds[0].id_); QuestSystem.aqid = qds[0].id_; } else { TaskUI tui = taskInfoObj.GetComponent <TaskUI> (); tui.closeItem(); tui.chuansongBtn.gameObject.SetActive(false); tui.abnegateBtn.gameObject.SetActive(false); } }
void OnClickTypeBtn(ButtonScript obj, object args, int param1, int param2) { switch ((TypeType)param1) { case TypeType.TT_Collection: int index = typeListGrid_.GetIndex(obj.transform); if (typeFlag[(int)TypeType.TT_Collection] && param2 != 1) { for (int i = 0; i < collectItemCache.Length; ++i) { if (collectItemCache[i] != null) { //typeListGrid_.RemoveChild(index + 1); typeListGrid_.RemoveChild(collectItemCache[i].transform); UIManager.RemoveButtonEventHandler(collectItemCache[i], EnumButtonEvent.OnClick); collectItemCache[i].SetActive(false); } } typeFlag[(int)TypeType.TT_Collection] = false; } else { GameObject colItem = null; for (int i = 0; i < AuctionHouseSystem.CollectionMax; ++i) { if (i < AuctionHouseSystem.collectionList_.Count) { string[] infos = AuctionHouseSystem.collectionList_[i].Split('|'); int id = int.Parse(infos[0]); int isItem = bool.Parse(infos[1]) == true? 1: 0; if (collectItemCache[i] == null) { colItem = GameObject.Instantiate(collectItem_) as GameObject; typeListGrid_.AddChild(colItem.transform, index + 1 + i); colItem.SetActive(true); colItem.transform.localScale = Vector3.one; colItem.GetComponent <CollectGood>().SetData(AuctionHouseSystem.collectionList_[i]); UIManager.SetButtonEventHandler(colItem, EnumButtonEvent.OnClick, OnCollectionSearch, id, isItem); UIManager.SetButtonEventHandler(colItem.GetComponent <CollectGood>().cancelCollectBtn_.gameObject, EnumButtonEvent.OnClick, OnUnCollect, i, isItem); collectItemCache[i] = colItem; } else { typeListGrid_.AddChild(collectItemCache[i].transform, index + 1 + i); collectItemCache[i].SetActive(true); collectItemCache[i].GetComponent <CollectGood>().SetData(AuctionHouseSystem.collectionList_[i]); UIManager.SetButtonEventHandler(collectItemCache[i].GetComponent <CollectGood>().cancelCollectBtn_.gameObject, EnumButtonEvent.OnClick, OnUnCollect, i, isItem); UIManager.SetButtonEventHandler(collectItemCache[i], EnumButtonEvent.OnClick, OnCollectionSearch, id, isItem); } } else { if (collectItemCache[i] != null) { UIManager.RemoveButtonEventHandler(collectItemCache[i], EnumButtonEvent.OnClick); collectItemCache[i].SetActive(false); } } } typeFlag[(int)TypeType.TT_Collection] = true; } //typeListGrid_.Reposition(); obj.GetComponent <MainGood>().SetTriangle(typeFlag[(int)TypeType.TT_Collection]); break; case TypeType.TT_Equip: index = typeListGrid_.GetIndex(obj.transform); if (typeFlag[(int)TypeType.TT_Equip]) { for (int i = 0; i < equipItemCache.Length; ++i) { if (equipItemCache[i] != null) { typeListGrid_.RemoveChild(index + 1); UIManager.RemoveButtonEventHandler(equipItemCache[i], EnumButtonEvent.OnClick); equipItemCache[i].SetActive(false); } } typeFlag[(int)TypeType.TT_Equip] = false; } else { GameObject subItem = null; for (int i = (int)ItemSubType.IST_None; i < (int)ItemSubType.IST_EquipMax - 1; ++i) { if (equipItemCache[i] == null) { subItem = GameObject.Instantiate(subItem_) as GameObject; typeListGrid_.AddChild(subItem.transform, index + 1 + i); subItem.transform.localScale = Vector3.one; SubGood sg = subItem.GetComponent <SubGood>(); sg.SetType(SubGood.GoodType.GT_Item); sg.SetData(LanguageManager.instance.GetValue(((ItemSubType)i + 1).ToString())); UIManager.SetButtonEventHandler(subItem, EnumButtonEvent.OnClick, OnSubTypeSearch, i + 1, 1); subItem.SetActive(true); equipItemCache[i] = subItem; } else { typeListGrid_.AddChild(equipItemCache[i].transform, index + 1 + i); UIManager.SetButtonEventHandler(equipItemCache[i], EnumButtonEvent.OnClick, OnSubTypeSearch, i + 1, 1); equipItemCache[i].SetActive(true); } } typeFlag[(int)TypeType.TT_Equip] = true; } typeListGrid_.Reposition(); obj.GetComponent <MainGood>().SetTriangle(typeFlag[(int)TypeType.TT_Equip]); break; case TypeType.TT_Baby: index = typeListGrid_.GetIndex(obj.transform); if (typeFlag[(int)TypeType.TT_Baby]) { for (int i = 0; i < babyItemCache.Length; ++i) { if (babyItemCache[i] != null) { typeListGrid_.RemoveChild(index + 1); UIManager.RemoveButtonEventHandler(babyItemCache[i], EnumButtonEvent.OnClick); babyItemCache[i].SetActive(false); } } typeFlag[(int)TypeType.TT_Baby] = false; } else { GameObject subItem = null; for (int i = (int)RaceType.RT_None; i < (int)RaceType.RT_Max - 1; ++i) { if (babyItemCache[i] == null) { subItem = GameObject.Instantiate(subItem_) as GameObject; typeListGrid_.AddChild(subItem.transform, index + 1 + i); subItem.transform.localScale = Vector3.one; SubGood sg = subItem.GetComponent <SubGood>(); sg.SetType(SubGood.GoodType.GT_Baby); string nameType = ((RaceType)i + 1).ToString(); sg.SetData(LanguageManager.instance.GetValue(((RaceType)i + 1).ToString()), BabyData.GetRaceIconByType((RaceType)i + 1)); UIManager.SetButtonEventHandler(subItem, EnumButtonEvent.OnClick, OnSubTypeSearch, i + 1, 0); subItem.SetActive(true); babyItemCache[i] = subItem; if (RaceType.RT_Human.ToString().Equals(nameType) || RaceType.RT_Metal.ToString().Equals(nameType)) { sg.dikuangSp.spriteName = "webzudidilan"; } if (RaceType.RT_Insect.ToString().Equals(nameType) || RaceType.RT_Animal.ToString().Equals(nameType)) { sg.dikuangSp.spriteName = "webzudihuang"; } if (RaceType.RT_Dragon.ToString().Equals(nameType) || RaceType.RT_Extra.ToString().Equals(nameType) || RaceType.RT_Undead.ToString().Equals(nameType)) { sg.dikuangSp.spriteName = "webzudihong"; } if (RaceType.RT_Fly.ToString().Equals(nameType) || RaceType.RT_Plant.ToString().Equals(nameType)) { sg.dikuangSp.spriteName = "webzudilv"; } } else { typeListGrid_.AddChild(babyItemCache[i].transform, index + 1 + i); UIManager.SetButtonEventHandler(babyItemCache[i], EnumButtonEvent.OnClick, OnSubTypeSearch, i + 1, 0); babyItemCache[i].SetActive(true); } } typeFlag[(int)TypeType.TT_Baby] = true; } typeListGrid_.Reposition(); obj.GetComponent <MainGood>().SetTriangle(typeFlag[(int)TypeType.TT_Baby]); break; case TypeType.TT_Item: index = typeListGrid_.GetIndex(obj.transform); if (typeFlag[(int)TypeType.TT_Item]) { for (int i = 0; i < consumItemCache.Length; ++i) { if (consumItemCache[i] != null) { typeListGrid_.RemoveChild(index + 1); UIManager.RemoveButtonEventHandler(consumItemCache[i], EnumButtonEvent.OnClick); consumItemCache[i].SetActive(false); } } typeFlag[(int)TypeType.TT_Item] = false; } else { GameObject subItem = null; for (int i = (int)ItemSubType.IST_None; i < (int)ItemSubType.IST_ConsEnd - (int)ItemSubType.IST_ConsBegin - 1; ++i) { if (consumItemCache[i] == null) { subItem = GameObject.Instantiate(subItem_) as GameObject; typeListGrid_.AddChild(subItem.transform, index + 1 + i); subItem.transform.localScale = Vector3.one; SubGood sg = subItem.GetComponent <SubGood>(); sg.SetType(SubGood.GoodType.GT_Item); sg.SetData(LanguageManager.instance.GetValue(((ItemSubType)i + (int)ItemSubType.IST_ConsBegin + 1).ToString())); UIManager.SetButtonEventHandler(subItem, EnumButtonEvent.OnClick, OnSubTypeSearch, i + (int)ItemSubType.IST_ConsBegin + 1, 1); subItem.SetActive(true); consumItemCache[i] = subItem; } else { typeListGrid_.AddChild(consumItemCache[i].transform, index + 1 + i); UIManager.SetButtonEventHandler(consumItemCache[i], EnumButtonEvent.OnClick, OnSubTypeSearch, i + (int)ItemSubType.IST_ConsBegin + 1, 1); consumItemCache[i].SetActive(true); } } typeFlag[(int)TypeType.TT_Item] = true; } typeListGrid_.Reposition(); obj.GetComponent <MainGood>().SetTriangle(typeFlag[(int)TypeType.TT_Item]); break; default: break; } }
private void OnSkillCell(ButtonScript obj, object args, int param1, int param2) { if (_chindItemCellObj != null && _chindItemCellObj != obj) { _chindItemCellObj.transform.FindChild("bg").FindChild("arrows").GetComponent <UISprite>().spriteName = "sanjiao"; _chindItemCellObj = null; } if (obj.transform.FindChild("bg").FindChild("arrows").GetComponent <UISprite>().spriteName == "sanjiao2") { obj.transform.FindChild("bg").FindChild("arrows").GetComponent <UISprite>().spriteName = "sanjiao"; foreach (GameObject c in chindCellList) { skillGrid.RemoveChild(c.transform); c.transform.parent = null; c.gameObject.SetActive(false); chindCellPoolList.Add(c); } chindCellList.Clear(); _chindItemCellObj = null; return; } else { obj.transform.FindChild("bg").FindChild("arrows").GetComponent <UISprite>().spriteName = "sanjiao2"; foreach (GameObject c in chindCellList) { skillGrid.RemoveChild(c.transform); c.transform.parent = null; c.gameObject.SetActive(false); chindCellPoolList.Add(c); } chindCellList.Clear(); _chindItemCellObj = obj; } int indx = skillGrid.GetIndex(obj.transform); int pLevel = param1; // GamePlayer.Instance.GetIprop (PropertyType.PT_Level) / 10 + 1; if (pLevel == 1) { pLevel = 0; } int index = 0; bool jobFirst = false; Profession pro = Profession.get((JobType)GamePlayer.Instance.GetIprop(PropertyType.PT_Profession), GamePlayer.Instance.GetIprop(PropertyType.PT_ProfessionLevel)); ItemSubType[] items = pro.CanUsedItems(GamePlayer.Instance.GetIprop(PropertyType.PT_ProfessionLevel) * 2 + 2); foreach (MakeData m in MakeData.metaData.Values) { if (_bJobEquip) { if ((pLevel <= m.skillLevel && m.skillLevel <= pLevel + 9) && m.type_ == "Player") { for (int i = 0; i < items.Length; i++) { if (ItemData.GetData(m.itemId_).subType_ == items[i]) { GameObject objCell = null; if (chindCellPoolList.Count > 0) { objCell = chindCellPoolList[0]; chindCellPoolList.Remove(objCell); } else { objCell = Object.Instantiate(chindItemCell.gameObject) as GameObject; } UIManager.SetButtonEventHandler(objCell, EnumButtonEvent.OnClick, OnClickChindItem, 0, 0); CompoundSkillCellUI cell = objCell.GetComponent <CompoundSkillCellUI>(); cell.SkillId = m.skillId; cell.MakeId = m.itemId_; cell.gameObject.transform.FindChild("bg").FindChild("recommend").GetComponent <UISprite>().gameObject.SetActive(true); skillGrid.AddChild(objCell.transform, ++indx); objCell.SetActive(true); objCell.transform.localScale = Vector3.one; chindCellList.Add(objCell); if (jobFirst == false && i == 0) { GuideManager.Instance.RegistGuideAim(objCell, GuideAimType.GAT_MainMakeSubFirst); } if (jobFirst == false) { jobFirst = true; } } } } } else { if ((ItemData.GetData(m.itemId_).slot_ == (EquipmentSlot)_selectEquipType || ((EquipmentSlot)_selectEquipType == EquipmentSlot.ES_SingleHand && ItemData.GetData(m.itemId_).slot_ == EquipmentSlot.ES_DoubleHand)) && (pLevel <= m.skillLevel && m.skillLevel <= pLevel + 9) && m.type_ == "Player") { GameObject objCell = null; if (chindCellPoolList.Count > 0) { objCell = chindCellPoolList[0]; chindCellPoolList.Remove(objCell); } else { objCell = Object.Instantiate(chindItemCell.gameObject) as GameObject; } UIManager.SetButtonEventHandler(objCell, EnumButtonEvent.OnClick, OnClickChindItem, 0, 0); CompoundSkillCellUI cell = objCell.GetComponent <CompoundSkillCellUI>(); cell.SkillId = m.skillId; cell.MakeId = m.itemId_; skillGrid.AddChild(objCell.transform, ++indx); objCell.SetActive(true); objCell.transform.localScale = Vector3.one; chindCellList.Add(objCell); if (index == 0) { GuideManager.Instance.RegistGuideAim(objCell, GuideAimType.GAT_MainMakeSubFirst); } if (index == 2) { GuideManager.Instance.RegistGuideAim(objCell, GuideAimType.GAT_MainMakeSubSecond); } if (index == 4) { GuideManager.Instance.RegistGuideAim(objCell, GuideAimType.GAT_MainMakeSubThird); } index++; } } } GuideManager.Instance.ProcEvent(ScriptGameEvent.SGE_MainMakeSub, GamePlayer.Instance.GetIprop(PropertyType.PT_Profession)); }