Esempio n. 1
0
    void OnClickChindItem(ButtonScript obj, object args, int param1, int param2)
    {
        TaskUI.CurrentId = param1;
        QuestSystem.aqid = param1;
        AcceptableCell acell = obj.GetComponent <AcceptableCell>();

        if (curCell != null)
        {
            curCell.stateSp.gameObject.SetActive(false);
            curCell.statetwoSp.gameObject.SetActive(false);
        }
        curCell = acell;
        acell.stateSp.gameObject.SetActive(true);
        acell.statetwoSp.gameObject.SetActive(true);
        //ShowTaskIonf (param1);
        TaskUI tui = taskInfoObj.GetComponent <TaskUI> ();

        tui.ShowTaskIonf(param1);
    }
Esempio n. 2
0
    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;
        }
    }
Esempio n. 3
0
    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);
        }
    }