//关闭处理
        public override void OnClosedProcess()
        {
            IsNpcTalk = false;
            if (conIcon.childCount > 0)
            {
                for (int i = 0; i < conIcon.childCount; i++)
                {
                    Destroy(conIcon.GetChild(i).gameObject);
                }
            }
            if (conOption.childCount > 0)
            {
                for (int i = 0; i < conOption.childCount; i++)
                {
                    Destroy(conOption.GetChild(i).gameObject);
                }
            }

            //if (hasWait)
            //{
            //    A3_TaskProxy.getInstance().addEventListener(A3_TaskProxy.ON_TASK_REFRESH, OnRefreshTask);
            //}
            A3_TaskProxy.getInstance().removeEventListener(A3_TaskProxy.ON_TASK_REFRESH, OnRefreshTask);
            base.OnClosedProcess();
        }
Esempio n. 2
0
 public void StopCD(bool isFinish = false)
 {
     BtnWait.interactable  = !(isWaiting = false);
     imgProcess.fillAmount = 0;
     StopCoroutine(RunCD());
     if (isFinish)
     {
         A3_TaskProxy.getInstance().SendWaitEnd(A3_TaskModel.getInstance().GetEntrustTask().taskId);
     }
 }
Esempio n. 3
0
 void OnStartBtnClick(GameObject go)
 {
     if (isEntrustMonsterAlive)
     {
         return;
     }
     A3_TaskProxy.getInstance().SendCallMonster((uint)A3_TaskModel.getInstance().GetEntrustTask().taskId);
     //timeKillTerminal = muNetCleint.instance.CurServerTimeStamp + A3_TaskModel.getInstance().GetEntrustTask().release_tm;
     winKillMon.SetActive(false);
 }
Esempio n. 4
0
 void OnWaitBtnClick(GameObject go)
 {
     timeWaitTerminal     = (int)timeCD * 1000 + NetClient.instance.CurServerTimeStampMS;
     BtnWait.interactable = !(isWaiting = true);
     A3_TaskProxy.getInstance().SendWaitStart(A3_TaskModel.getInstance().GetEntrustTask().taskId);
     if (timeCD > 0)
     {
         StartCoroutine(RunCD());
     }
 }
 //提交任务
 private void OnSubmitTask(GameObject go)
 {
     btnNext.interactable = false;
     A3_TaskProxy.getInstance().SendGetAward();
     if (!/*tkModel.*/ curTask.story_hint.Equals("null"))
     {
         flytxt.instance.fly(/*tkModel.*/ curTask.story_hint, 8);
     }
     dialog.next();
 }
 //显示任务界面
 private void OnShowTaskUi()
 {
     IsNpcTalk = true;
     if (curTask.isComplete)
     {
         ShowTask();
     }
     else
     {
         //未完成时的显示奖励
         conIcon.gameObject.SetActive(true);
         OnShowAwardInfo();
         if (/*tkModel.*/ curTask.targetType == TaskTargetType.VISIT)
         {
             A3_TaskProxy.getInstance().addEventListener(A3_TaskProxy.ON_TASK_REFRESH, OnRefreshTask);
             //hasWait = true;
             //InterfaceMgr.getInstance().open(InterfaceMgr.WAIT_LOADING);
             //dialog
             A3_TaskProxy.getInstance().SendTalkWithNpc(dialog.m_npc.id);
         }
         if (/*tkModel.*/ curTask.targetType == TaskTargetType.GETEXP)
         {
             SXML taskXml = XMLMgr.instance.GetSXML("task.Task", "id==" + /*tkModel.*/ curTask.taskId);
             int  type    = int.Parse(taskXml.getString("trigger"));
             if (type == 2)
             {
                 btnNext.interactable = true;
                 btnNext.transform.FindChild("Text").GetComponent <Text>().text = ContMgr.getCont("npctasktalk0");
                 btnNext.onClick = OnOpenZhuan;
             }
         }
         if (curTask.targetType == TaskTargetType.GET_ITEM_GIVEN)
         {
             A3_TaskOpt.Instance.taskItemId = (uint)/*tkModel.*/ curTask.completionAim;
             btnNext.transform.FindChild("Text").GetComponent <Text>().text = ContMgr.getCont("npctasktalk1");
             btnNext.onClick += (go) =>
             {
                 int needNum = curTask.completion - curTask.taskRate;
                 int holdNum = a3_BagModel.getInstance().getItemNumByTpid(A3_TaskOpt.Instance.taskItemId);
                 if (holdNum < needNum)
                 {
                     InterfaceMgr.getInstance().close(InterfaceMgr.DIALOG);
                     ArrayList data = new ArrayList();
                     data.Add(a3_BagModel.getInstance().getItemDataById(A3_TaskOpt.Instance.taskItemId));
                     InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_ITEMLACK, data);
                     A3_TaskOpt.Instance.HideSubmitItem();
                 }
                 else
                 {
                     A3_TaskOpt.Instance?.ShowSubmitItem();
                 }
             };
         }
     }
 }
Esempio n. 7
0
 void OnStartBtnClick(GameObject go)
 {
     if (curTaskId != 0 && taskOptElement[curTaskId].isTaskMonsterAlive)
     {
         flytxt.instance.fly(ContMgr.getCont("a3_taskopt_monsteralive"));
         winKillMon.SetActive(false);
         return;
     }
     A3_TaskProxy.getInstance().SendCallMonster((uint)curTaskId);
     winKillMon.SetActive(false);
 }
Esempio n. 8
0
 public void OnWaitBtnClick(GameObject go)
 {
     SelfRole.fsm.Stop();
     timeWaitTerminal     = (int)timeCD * 1000 + NetClient.instance.CurServerTimeStampMS;
     BtnWait.interactable = !(isWaiting = true);
     A3_TaskProxy.getInstance().SendWaitStart(curTaskId);
     if (timeCD > 0)
     {
         TaskData task = A3_TaskModel.getInstance().GetTaskDataById(curTaskId);
         StartCoroutine(RunCD());
     }
 }
Esempio n. 9
0
        public override void init()
        {
            Instance     = this;
            tfParentWait = transform.FindChild("wait");
            tfParentWait.gameObject.SetActive(false);
            imgProcess = tfParentWait.FindChild("waitBG").GetComponent <Image>();
            (BtnWait = new BaseButton(tfParentWait.FindChild("waitBG/btnDoWait"))).onClick = OnWaitBtnClick;
            winKillMon = transform.FindChild("killmon").gameObject;
            winKillMon.SetActive(false);
            tfSubmitItem    = transform.FindChild("submitItem");
            tfSubmitItemCon = tfSubmitItem.FindChild("mask/scrollview/con");
            tfFocus         = tfSubmitItem.FindChild("focus");
            tfFocus.gameObject.SetActive(false);
            tfSubmitItem.gameObject.SetActive(false);
            Transform tfBtnStart  = winKillMon.transform.FindChild("btnStart");
            Transform tfBtnCancel = winKillMon.transform.FindChild("btnDontStart");

            new BaseButton(tfBtnStart).onClick  = OnStartBtnClick;
            new BaseButton(tfBtnCancel).onClick = OnCancelBtnClick;
            new BaseButton(transform.FindChild("submitItem/closeBtn")).onClick = (btnClose) => tfSubmitItem.gameObject.SetActive(false);
            new BaseButton(tfSubmitItem.FindChild("btnOK")).onClick            = (go) =>
            {
                if (submitItemIId != 0)
                {
                    A3_TaskProxy.getInstance().SendSubmit(A3_TaskModel.getInstance().GetEntrustTask()?.taskId ?? 0, submitItemIId);
                }
                tfSubmitItem.gameObject.SetActive(false);
            };
            transform.SetParent(skillbar.instance.transform);
            if (a3_liteMinimap.instance)
            {
                LiteMinimapEntrustTaskTip = a3_liteMinimap.instance.GetEntrustTaskPage()?.GetComponent <Text>();
            }
            A3_TaskProxy.getInstance().addEventListener(A3_TaskProxy.ON_TASK_REFRESH, OnCheck);
            //A3_TaskProxy.getInstance().addEventListener(A3_TaskProxy.ON_SYNC_TASK, OnCheck); //在服务器运行较缓慢时使用
            if (A3_TaskModel.getInstance().GetEntrustTask()?.lose_tm > muNetCleint.instance.CurServerTimeStamp)
            {
                isKeepingKillMon          =
                    isEntrustMonsterAlive = true;
                timeKillTerminal          = A3_TaskModel.getInstance().GetEntrustTask().lose_tm;
            }
            Instance.name = "A3_EntrustOpt";
        }
Esempio n. 10
0
 override public void removeListener()
 {
     A3_TaskProxy.getInstance().removeEventListener(A3_TaskProxy.ON_GET_NEW_TASK, onHanlde);
 }
Esempio n. 11
0
        private bool Execute(TaskData taskData, bool checkNextStep, bool checkItems, bool clickAuto)
        {
            if (taskData.taskT == TaskType.CLAN && A3_LegionModel.getInstance().myLegion.id == 0)
            {
                flytxt.instance.fly(ContMgr.getCont("a3_task_auto_nocy"));
                return(false);
            }
            //这里将任务的自动改成只读配置表(待测试)
            bool forceMove = taskData.next_step;

            if (forceMove || clickAuto)
            {
                if (SelfRole.fsm.Autofighting)
                {
                    SelfRole.fsm.Stop();
                    StateInit.Instance.Origin = Vector3.zero;
                }
            }
            else
            {
                return(false);
            }

            int npcId = 0;
            int mapId = 0;
            int posX  = 0;
            int posY  = 0;


            SXML taskXml = XMLMgr.instance.GetSXML("task.Task", "id==" + taskData.taskId);

            if (taskXml == null)
            {
                debug.Log("任务Id错误::" + taskData.taskId);
                return(false);
            }
            if (taskData.isComplete && taskData.taskT != TaskType.DAILY)
            {
                if (taskXml.getInt("complete_way") == 3)
                {
                    A3_TaskProxy.getInstance().SendGetAward();
                    return(true);
                }
                npcId = taskXml.getInt("complete_npc_id");
                SXML npcsXml = XMLMgr.instance.GetSXML("npcs.npc", "id==" + npcId);
                if (npcsXml != null)
                {
                    mapId = npcsXml.getInt("map_id");
                }
                List <string> listDialog = new List <string>();

                string strDialog = taskXml.getString("complete_dialog");
                strDialog = GameFramework.StringUtils.formatText(strDialog);
                string[] listTempDia = strDialog.Split(';');
                listDialog = listTempDia.ToList <string>();

                tarNpcId = npcId;
                //if(forceMove)
                //InterfaceMgr.getInstance().open(InterfaceMgr.TRANSMIT_PANEL, (ArrayList)new TransmitData
                //{
                //    mapId = mapId,
                //    check_beforeShow = true,
                //    handle_customized_afterTransmit = () => SelfRole.moveToNPc(mapId, npcId, listDialog, OnTalkWithNpc)
                //});
                if (!PlayerModel.getInstance().inFb&& mapId != GRMap.instance.m_nCurMapID && MapModel.getInstance().dicMappoint.ContainsKey(mapId) && MapModel.getInstance().dicMappoint[mapId] != GRMap.instance.m_nCurMapID)
                {
                    SelfRole.Transmit(toid: MapModel.getInstance().dicMappoint[mapId], after: () => SelfRole.moveToNPc(mapId, npcId, listDialog, OnTalkWithNpc, taskmove: true), taskTrans: true);
                }
                else
                {
                    SelfRole.moveToNPc(mapId, npcId, listDialog, OnTalkWithNpc, taskmove: true);
                }
            }
            else
            {
                mapId = taskXml.getInt("tasking_map_id");
                posX  = taskXml.getInt("target_coordinate_x");
                posY  = taskXml.getInt("target_coordinate_y");
                float mapY = taskXml.getFloat("map_y");
                mapY = (mapY == -1 ? 0 : mapY);
                Vector3 pos = new Vector3(posX, mapY, posY);
                switch (taskData.targetType)
                {
                case TaskTargetType.DODAILY:     /*页面切换到每日任务*/
                    ArrayList arr          = new ArrayList();
                    var       tasks        = A3_TaskModel.getInstance().GetDicTaskData();
                    bool      hasDailyTask = false;
                    int       i            = 0;
                    for (List <int> idx = new List <int>(tasks.Keys); i < tasks.Count; i++)
                    {
                        if (hasDailyTask = tasks[idx[i]].taskT == TaskType.DAILY)
                        {
                            break;
                        }
                    }
                    if (hasDailyTask /*tasks.Count(v => v.Value.taskT == TaskType.DAILY) > 0*/)
                    {
                        List <int> k = tasks.Keys.ToList();
                        for (i = 0; i < k.Count; i++)
                        {
                            if (tasks[k[i]].taskT == TaskType.DAILY)
                            {
                                arr.Add(tasks[k[i]].taskId);
                            }
                        }
                        InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_TASK, arr);
                        //MonsterMgr._inst.taskMonId = XMLMgr.instance.GetSXML("task.Task", "id==" + taskData.taskId)?.getInt("target_param2") ?? 0;
                    }
                    break;

                case TaskTargetType.FRIEND:     /*关闭当前页面,弹出好友页面*/
                    if (a3_liteMinimap.instance)
                    {
                        a3_liteMinimap.instance.ZidongTask = false;
                    }
                    arr = new ArrayList();
                    arr.Add(1 /* index of friend panel*/);
                    InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_SHEJIAO, arr);
                    break;

                case TaskTargetType.WING:     /*关闭当前页面,弹出飞翼页面*/
                    if (a3_liteMinimap.instance)
                    {
                        a3_liteMinimap.instance.ZidongTask = false;
                    }
                    InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_WIBG_SKIN);
                    break;

                case TaskTargetType.GETEXP:    /*卡级任务、转生任务*/

                    debug.Log("当前是转生等级任务");
                    StateAutoMoveToPos.Instance.stopdistance = 0.3f;
                    int zs           = int.Parse(taskXml.getString("target_param2").Split(',')[0]);
                    int ls           = int.Parse(taskXml.getString("target_param2").Split(',')[1]);
                    int trriger_type = int.Parse(taskXml.getString("trigger"));
                    if (trriger_type == 1)
                    {
                        if (a3_liteMinimap.instance)
                        {
                            a3_liteMinimap.instance.ZidongTask = false;
                        }
                        InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_WANTLVUP);
                    }
                    else
                    {
                        bool b       = true;
                        int  pp      = PlayerModel.getInstance().profession;
                        uint pl      = PlayerModel.getInstance().lvl;
                        uint pz      = PlayerModel.getInstance().up_lvl;
                        uint exp     = PlayerModel.getInstance().exp;
                        uint needExp = ResetLvLModel.getInstance().getNeedExpByCurrentZhuan(pp, pz);
                        uint needLvL = ResetLvLModel.getInstance().getNeedLvLByCurrentZhuan(pp, pz);
                        if (pz >= 10)
                        {
                            break;              //10转之后无法再次转生
                        }
                        if (needLvL > pl)
                        {
                            b = false;
                        }
                        if (b)
                        {
                            npcId = XMLMgr.instance.GetSXML("task.zhuan_npc").getInt("id");
                            SXML npcsXml = XMLMgr.instance.GetSXML("npcs.npc", "id==" + npcId);
                            if (npcsXml != null)
                            {
                                mapId = npcsXml.getInt("map_id");
                            }

                            List <string> listDialog = new List <string>();

                            string strDialog = taskXml.getString("target_dialog");
                            strDialog = GameFramework.StringUtils.formatText(strDialog);
                            string[] listTempDia = strDialog.Split(';');
                            listDialog = listTempDia.ToList <string>();

                            //if (GRMap.instance != null)
                            //{
                            //    InterfaceMgr.getInstance().open(InterfaceMgr.TRANSMIT_PANEL, (ArrayList)new TransmitData
                            //    {
                            //        mapId = mapId,
                            //        check_beforeShow = true,
                            //        handle_customized_afterTransmit = () => SelfRole.moveToNPc(mapId, npcId, listDialog, OnTalkWithNpc)
                            //    });
                            //}
                            if (!PlayerModel.getInstance().inFb&& mapId != GRMap.instance.m_nCurMapID && MapModel.getInstance().dicMappoint.ContainsKey(mapId) && MapModel.getInstance().dicMappoint[mapId] != GRMap.instance.m_nCurMapID)
                            {
                                SelfRole.Transmit(toid: MapModel.getInstance().dicMappoint[mapId], after: () => SelfRole.moveToNPc(mapId, npcId, listDialog, OnTalkWithNpc, taskmove: true), taskTrans: true);
                            }
                            else
                            {
                                SelfRole.moveToNPc(mapId, npcId, listDialog, OnTalkWithNpc, taskmove: true);
                            }
                            //InterfaceMgr.getInstance().open(InterfaceMgr.A3_RESETLVL);
                        }
                        else
                        {
                            if (a3_liteMinimap.instance)
                            {
                                a3_liteMinimap.instance.ZidongTask = false;
                            }
                            InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_WANTLVUP);
                        }
                    }
                    break;

                case TaskTargetType.VISIT:    /*访问(无条件)*/
                {
                    StateAutoMoveToPos.Instance.stopdistance = 2f;
                    npcId = taskXml.getInt("target_param2");
                    SXML npcsXml = XMLMgr.instance.GetSXML("npcs.npc", "id==" + npcId);
                    if (npcsXml != null)
                    {
                        mapId = npcsXml.getInt("map_id");
                    }

                    List <string> listDialog = new List <string>();
                    string        strDialog  = taskXml.getString("target_dialog");
                    strDialog = GameFramework.StringUtils.formatText(strDialog);
                    string[] listTempDia = strDialog.Split(';');
                    listDialog = listTempDia.ToList <string>();

                    tarNpcId = npcId;
                    if (GRMap.instance != null)
                    {
                        //InterfaceMgr.getInstance().open(InterfaceMgr.TRANSMIT_PANEL, (ArrayList)new TransmitData
                        //{
                        //    mapId = mapId,
                        //    check_beforeShow = true,
                        //    handle_customized_afterTransmit = () => SelfRole.moveToNPc(mapId, npcId, listDialog, OnTalkWithNpc)
                        //});
                        if (!PlayerModel.getInstance().inFb&& mapId != GRMap.instance.m_nCurMapID && MapModel.getInstance().dicMappoint.ContainsKey(mapId) && MapModel.getInstance().dicMappoint[mapId] != GRMap.instance.m_nCurMapID)
                        {
                            SelfRole.Transmit(toid: MapModel.getInstance().dicMappoint[mapId], after: () => SelfRole.moveToNPc(mapId, npcId, listDialog, OnTalkWithNpc, taskmove: true), taskTrans: true);
                        }
                        else
                        {
                            SelfRole.moveToNPc(mapId, npcId, listDialog, OnTalkWithNpc, taskmove: true);
                        }
                    }
                }
                break;

                case TaskTargetType.KILL:    /*杀怪类*/
                    //StateAutoMoveToPos.Instance.stopdistance = 2.0f;
                    SelfRole.UnderTaskAutoMove = true;
                    onTaskSearchMon            = taskData.taskT == TaskType.MAIN;
                    int _taskId;
                    if (PlayerModel.getInstance().task_monsterId.ContainsKey(taskData.taskId))
                    {
                        if (!PlayerModel.getInstance().task_monsterIdOnAttack.ContainsKey(taskData.taskId))
                        {
                            PlayerModel.getInstance().task_monsterIdOnAttack.Add(
                                key: taskData.taskId,
                                value: PlayerModel.getInstance().task_monsterId[taskData.taskId]
                                );
                        }
                        PlayerModel.getInstance().task_monsterId.Remove(taskData.taskId);
                        _taskId = taskData.taskId;
                    }
                    else
                    {
                        _taskId = A3_TaskModel.getInstance().GetTaskXML().GetNode("Task", "id==" + taskData.taskId).getInt("target_param2");
                        PlayerModel.getInstance().task_monsterIdOnAttack.Add(
                            key: taskData.taskId,
                            value: _taskId
                            );
                    }
                    SXML _taskXml = XMLMgr.instance.GetSXML("task.Task", "id==" + taskData.taskId);
                    //InterfaceMgr.getInstance().open(InterfaceMgr.TRANSMIT_PANEL, (ArrayList)new TransmitData
                    //{
                    //    mapId = mapId,
                    //    check_beforeShow = true,
                    //    handle_customized_afterTransmit = () =>
                    //    {
                    //        Vector3 fightOrigin = pos;
                    //        StateInit.Instance.Origin = fightOrigin;
                    //        SelfRole.moveto(mapId, pos, () =>
                    //        {
                    //            SelfRole.fsm.StartAutofight();
                    //            MonsterMgr._inst.taskMonId = _taskXml.getInt("target_param2");
                    //        }, stopDis: 2.0f);
                    //    }
                    //});
                    Action afterTransmit = () => {
                        Vector3 fightOrigin = pos;
                        StateInit.Instance.Origin = fightOrigin;
                        SelfRole.moveto(mapId, pos, () =>
                        {
                            SelfRole.fsm.StartAutofight();
                            MonsterMgr._inst.taskMonId = _taskXml.getInt("target_param2");
                        }, stopDis: 2.0f, taskmove: true);
                    };
                    if (!PlayerModel.getInstance().inFb&& mapId != GRMap.instance.m_nCurMapID && MapModel.getInstance().dicMappoint.ContainsKey(mapId) && MapModel.getInstance().dicMappoint[mapId] != GRMap.instance.m_nCurMapID)
                    {
                        SelfRole.Transmit(toid: MapModel.getInstance().dicMappoint[mapId], after: afterTransmit, taskTrans: true);
                    }
                    else
                    {
                        SelfRole.WalkToMap(mapId, pos, afterTransmit, taskmove: true);
                    }
                    break;

                case TaskTargetType.COLLECT:

                    //Action afterTransmit_collect = () =>
                    //{
                    //    StateAutoMoveToPos.Instance.stopdistance = 0.3f;
                    //    SelfRole.moveto(mapId, pos, () => SelfRole.fsm.StartAutoCollect());
                    //};
                    Action afterTransmit_collect = () => SelfRole.WalkToMap(mapId, pos, SelfRole.fsm.StartAutoCollect, taskmove: true);
                    if (!PlayerModel.getInstance().inFb&& mapId != GRMap.instance.m_nCurMapID && MapModel.getInstance().dicMappoint.ContainsKey(mapId) && MapModel.getInstance().dicMappoint[mapId] != GRMap.instance.m_nCurMapID)
                    {
                        SelfRole.Transmit(toid: MapModel.getInstance().dicMappoint[mapId], after: afterTransmit_collect, taskTrans: true);
                    }
                    else
                    {
                        afterTransmit_collect();
                    }
                    break;

                case TaskTargetType.FB:
                    if (a3_liteMinimap.instance)
                    {
                        a3_liteMinimap.instance.ZidongTask = false;
                    }
                    int fbid = taskXml.getInt("target_param2");
                    //StateAutoMoveToPos.Instance.stopdistance = 0.3f;
                    if (GRMap.instance.m_nCurMapID == mapId || GameRoomMgr.getInstance().curRoom is PlotRoom)
                    {
                        SelfRole.moveto(mapId, pos, () => SelfRole.fsm.StartAutofight(), stopDis: 2.0f, taskmove: true /* 副本中开始战斗的停止距离 */);
                    }
                    else
                    {
                        Variant sendData = new Variant();
                        sendData["npcid"]    = 0;
                        sendData["ltpid"]    = fbid;
                        sendData["diff_lvl"] = 1;
                        int  levelinfoid = taskXml.getInt("level_info");
                        var  tainf       = XMLMgr.instance.GetSXML("task.level_info", "id==" + levelinfoid);
                        bool guide       = (taskXml.getInt("guide") == 1);
                        int  type        = taskXml.getInt("level_yw");
                        if (type == 1)
                        {
                            MsgBoxMgr.getInstance().showTask_fb_confirm(tainf.getString("title"), tainf.getString("desc"),
                                                                        guide, a3_ygyiwuModel.getInstance().GetYiWu_God(a3_ygyiwuModel.getInstance().nowGod_id).need_zdl, () => LevelProxy.getInstance().sendCreate_lvl(sendData));
                        }
                        else
                        {
                            MsgBoxMgr.getInstance().showTask_fb_confirm(tainf.getString("title"), tainf.getString("desc"),
                                                                        guide, () => LevelProxy.getInstance().sendCreate_lvl(sendData));
                        }
                    }
                    break;

                case TaskTargetType.WAIT_POINT_GIVEN:   /*在指定区域读条*/
                case TaskTargetType.GET_ITEM_GIVEN:     /*收集指定道具*/
                case TaskTargetType.KILL_MONSTER_GIVEN: /*打指定怪物*/
                    DealByType(taskData, checkItems);
                    break;
                }
                SXML _taskXML = XMLMgr.instance.GetSXML("task.Task", "id==" + taskData.taskId);
                if (SelfRole.UnderTaskAutoMove = taskData.targetType == TaskTargetType.KILL)
                {
                    StateAutoMoveToPos.Instance.stopdistance = 2.0f;
                    Vector3 fightOrigin = new Vector3(
                        x: _taskXML.getInt("target_coordinate_x"),
                        y: 0,
                        z: _taskXML.getInt("target_coordinate_y")
                        );
                    StateInit.Instance.Origin = fightOrigin;
                }
                if (taskData.targetType == TaskTargetType.KILL || taskData.targetType == TaskTargetType.DODAILY)
                {
                    int monId = _taskXML.getInt("target_param2");
                    if (monId != -1)
                    {
                        MonsterMgr._inst.taskMonId = monId;
                    }
                }
            }
            return(true);
        }
Esempio n. 12
0
        public override void init()
        {
            Instance     = this;
            tfParentWait = transform.FindChild("wait");
            tfParentWait.gameObject.SetActive(false);
            imgProcess = tfParentWait.FindChild("waitBG").GetComponent <Image>();
            (BtnWait = new BaseButton(tfParentWait.FindChild("waitBG/btnDoWait"))).onClick = OnWaitBtnClick;
            actionImage = tfParentWait.FindChild("waitBG/btnDoWait").GetComponent <Image>();
            winKillMon  = transform.FindChild("killmon").gameObject;
            winKillMon.SetActive(false);
            winKillDragon = transform.FindChild("killDragon").gameObject;
            winKillDragon.SetActive(false);
            tfSubmitItem        = transform.FindChild("submitItem");
            tfSubmitItemMainCon = tfSubmitItem.FindChild("mask/scrollview/rect");
            tfSubmitItemCon     = tfSubmitItem.FindChild("mask/scrollview/rect/con");
            tfFocus             = tfSubmitItem.FindChild("focus");
            tfFocus.gameObject.SetActive(false);
            tfSubmitItem.gameObject.SetActive(false);
            tfBtnStart = winKillMon.transform.FindChild("btnStart");
            Transform tfBtnCancel = winKillMon.transform.FindChild("btnDontStart");

            new BaseButton(tfBtnStart).onClick  = OnStartBtnClick;
            new BaseButton(tfBtnCancel).onClick = OnCancelBtnClick;
            new BaseButton(transform.FindChild("submitItem/closeBtn")).onClick = (btnClose) => tfSubmitItem.gameObject.SetActive(false);
            new BaseButton(transform.FindChild("killmon/closeArea")).onClick   = (go) => go.transform.parent.gameObject.SetActive(false);
            new BaseButton(tfSubmitItem.FindChild("btnOK")).onClick            = (go) =>
            {
                if (submitItemIId != 0 && curTaskId != 0)
                {
                    A3_TaskProxy.getInstance().SendSubmit(curTaskId, submitItemIId);
                }
                tfSubmitItem.gameObject.SetActive(false);
            };
            //transform.SetParent(skillbar.instance.transform);
            A3_TaskProxy.getInstance().addEventListener(A3_TaskProxy.ON_TASK_REFRESH, OnCheck);
            A3_TaskProxy.getInstance().addEventListener(A3_TaskProxy.ON_GET_NEW_TASK, OnCheck);

            taskOptElement = new Dictionary <int, TaskOptElement>();
            Dictionary <int, TaskData> listTask = A3_TaskModel.getInstance().GetDicTaskData();
            List <int> idx = new List <int>(listTask.Keys);

            for (int i = 0; i < idx.Count; i++)
            {
                int taskId = idx[i];
                if (listTask[taskId].release_tm > 0)
                {
                    if (listTask[taskId].lose_tm > muNetCleint.instance.CurServerTimeStamp)
                    {
                        taskOptElement[taskId] =
                            new TaskOptElement(taskId,
                                               isKeepingKillMon: true,
                                               isTaskMonsterAlive: true //,
                                                                        //timeKillTerminal: A3_TaskModel.getInstance().GetTaskDataById(taskId).lose_tm
                                               );
                        taskOptElement[taskId].InitUi(
                            liteMinimapTaskTimer: a3_liteMinimap.instance.GetTaskPage(taskId)?.transform.FindChild("name/timer").GetComponent <Text>()
                            );
                    }
                }
            }
            Instance.name         = "A3_TaskOpt";
            waitThresholdDistance = XMLMgr.instance.GetSXML("task.range").getFloat("action_range") / GameConstant.PIXEL_TRANS_UNITYPOS;
            scaleIcon             = transform.FindChild("submitItem/iconConfig")?.localScale ?? Vector3.zero;
            new BaseButton(winKillDragon.transform.FindChild("btnStart")).onClick = (go) =>
            {
                uint dragonId = A3_SlayDragonModel.getInstance().GetUnlockedDragonId();
                int  diffLv   = A3_SlayDragonModel.getInstance().GetUnlockedDiffLv();
                A3_SlayDragonProxy.getInstance().SendGo();
            };
            new BaseButton(winKillDragon.transform.FindChild("btnNope")).onClick = (go) => winKillDragon.SetActive(false);
            if (!IsInvoking("RunTimer"))
            {
                InvokeRepeating("RunTimer", 0f, 1.0f);
            }



            getComponentByPath <Text>("killmon/bg/desc").text           = ContMgr.getCont("A3_TaskOpt_0");
            getComponentByPath <Text>("killmon/btncreatteam/Text").text = ContMgr.getCont("A3_TaskOpt_1");
            getComponentByPath <Text>("killmon/btnDontStart/Text").text = ContMgr.getCont("A3_TaskOpt_2");
            getComponentByPath <Text>("killmon/btnStart/Text").text     = ContMgr.getCont("A3_TaskOpt_3");
            getComponentByPath <Text>("wait/action_text").text          = ContMgr.getCont("A3_TaskOpt_4");
            getComponentByPath <Text>("submitItem/title/Text").text     = ContMgr.getCont("A3_TaskOpt_5");
            getComponentByPath <Text>("submitItem/btnOK/text").text     = ContMgr.getCont("A3_TaskOpt_6");
            getComponentByPath <Text>("killDragon/bg/desc").text        = ContMgr.getCont("A3_TaskOpt_7");
            getComponentByPath <Text>("killDragon/btnStart/Text").text  = ContMgr.getCont("A3_TaskOpt_8");
            getComponentByPath <Text>("killDragon/btnNope/Text").text   = ContMgr.getCont("A3_TaskOpt_2");
        }
Esempio n. 13
0
 public override void onShowed()
 {
     A3_TaskProxy.getInstance().addEventListener(A3_TaskProxy.ON_GET_TASK_AWARD, OnStopTimer);
     base.onShowed();
 }