void AddQuestKindItem() { for (int i = 0; i < QuestKindsObj.Count; i++) { TaskKindCell taCell = QuestKindsObj[i].GetComponent <TaskKindCell>(); taCell.raSp.spriteName = "sanjiao"; taCell.backSp.gameObject.SetActive(false); QuestKindsObj[i].SetActive(false); } for (int i = 0; i < QuestKinds.Count; i++) { GameObject go = null; if (i < QuestKindsObj.Count) { go = QuestKindsObj[i]; } else { go = GameObject.Instantiate(questKind_item) as GameObject; } go.SetActive(true); go.transform.parent = maingrid.transform; go.transform.localPosition = Vector3.zero; go.transform.localScale = Vector3.one; QuestKindsObj.Add(go); UILabel la = go.GetComponentInChildren <UILabel>(); la.text = LanguageManager.instance.GetValue(QuestKinds[i].ToString()); UIManager.SetButtonEventHandler(go, EnumButtonEvent.OnClick, OnClickReceive, (int)QuestKinds[i], 0); maingrid.repositionNow = true; } }
void ChooseKindItem() { if (QuestKindsObj.Count > 0) { btnsp = QuestKindsObj[0]; isOpen = true; TaskKindCell taCell = btnsp.GetComponent <TaskKindCell>(); taCell.raSp.spriteName = "sanjiao2"; taCell.backSp.gameObject.SetActive(true); InitQuestKindItem(); } }
void OnClickReceive(ButtonScript obj, object args, int param1, int param2) { if (btnsp != obj.gameObject && btnsp != null) { TaskKindCell taCell = btnsp.GetComponent <TaskKindCell>(); taCell.raSp.spriteName = "sanjiao"; taCell.backSp.gameObject.SetActive(false); } if (btnsp != obj.gameObject) { if (isOpen) { foreach (GameObject c in chindCellList) { maingrid.RemoveChild(c.transform); c.transform.parent = null; c.gameObject.SetActive(false); chindCellPoolList.Add(c); } chindCellList.Clear(); maingrid.Reposition(); isOpen = false; } TaskKindCell taCell = obj.GetComponent <TaskKindCell>(); taCell.raSp.spriteName = "sanjiao2"; taCell.backSp.gameObject.SetActive(true); } else { TaskKindCell taCell = obj.GetComponent <TaskKindCell>(); taCell.raSp.spriteName = "sanjiao"; taCell.backSp.gameObject.SetActive(false); if (isOpen) { foreach (GameObject c in chindCellList) { maingrid.RemoveChild(c.transform); c.transform.parent = null; c.gameObject.SetActive(false); chindCellPoolList.Add(c); } chindCellList.Clear(); maingrid.Reposition(); isOpen = false; return; } else { TaskKindCell taCells = obj.GetComponent <TaskKindCell>(); taCells.raSp.spriteName = "sanjiao2"; taCells.backSp.gameObject.SetActive(true); } } isOpen = true; btnsp = obj.gameObject; int index = maingrid.GetIndex(obj.transform); List <QuestData> qdas = QuestSystem.GetQuestDataForQuestKind((QuestKind)param1); 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]); } } } } else if (qdas[i].questKind_ == QuestKind.QK_Daily) { if (QuestSystem.IsFDailyQuest()) { continue; } if (IsQuestDailyLevel(qdas[i])) { qds.Add(qdas[i]); } } else { qds.Add(qdas[i]); } } for (int i = 0; i < qds.Count; i++) { if (qds[i].targetId_ != 0 && qds[i].questKind_ == QuestKind.QK_Tongji && qds[i].questType_ == QuestType.QT_Kill) { continue; } if (qds[i].targetId_ != 0 && qds[i].questKind_ == QuestKind.QK_Rand) { 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; } }