Exemple #1
0
        public static void GotoCollectObj(int collectObjID, bool bCarry = false)
        {
            KCollectMissionInfo info = KConfigFileManager.GetInstance().GetCollectInfo(collectObjID);

            if (info != null)
            {
                if (info.strPosition != null && info.strPosition != "0")
                {
                    string[] pos = info.strPosition.Split(';');

                    if (pos.Length != 0)
                    {
                        string[] posTemp = pos[0].Split(':');
                        if (posTemp.Length == 3)
                        {
                            if (bCarry)
                            {
                                Carry(info.nSceneID, new Vector3(int.Parse(posTemp[0]), int.Parse(posTemp[1]), int.Parse(posTemp[2])));
                            }
                            else
                            {
                                Vector3 vecPosition = MapUtils.GetMetreFromInt(int.Parse(posTemp[0]), int.Parse(posTemp[2]), int.Parse(posTemp[1]));
                                Goto(info.nSceneID, vecPosition);
                            }

                            CollectObjLogic.GetInstance().m_bAutoCollect = true;
                        }
                    }
                }
            }
        }
Exemple #2
0
        public override void DoUpdate()
        {
            if (PathUtil.NPC_ID != -1)
            {
                if (NpcLogic.GetInstance().CheckNpcNearby(PathUtil.NPC_ID))
                {
                    if (PathUtil.bAutoAttack)
                    {
                        SceneLogic.GetInstance().MainHero.property.CmdAutoAttack = true;
                    }
                    else
                    {
                        EventDispatcher.GameWorld.Dispath(ControllerCommand.OPEN_NPC_PANEL_BYID, PathUtil.NPC_ID);
                    }

                    PathUtil.bAutoAttack = false;
                    PathUtil.NPC_ID      = -1;
                }
            }

            ViewManager.GetInstance().AutoCloseNpcPanel();

            CollectObjComponent[] collectObjs = SceneLogic.GetInstance().GetAllCollectObj();

            foreach (CollectObjComponent coc in collectObjs)
            {
                if (CollectObjLogic.GetInstance().CheckNeedCollectID(coc.Owner.collectInfo.nID) && coc.CheckNearBy(coc.Owner.collectInfo.nCanCollectDistance))
                {
                    EventDispatcher.GameWorld.Dispath(ControllerCommand.OPEN_COLLECT_PANEL, coc.Owner.collectInfo.nID, coc.Owner.property.Id);
                    break;
                }
            }
        }
Exemple #3
0
 public void InterruptCollectObj()
 {
     if (collectView != null && collectView.isOpen())
     {
         CollectObjLogic.GetInstance().OnInterruptCollect(null);
         collectView.Close();
     }
 }
Exemple #4
0
        private object UpdateMission(params object[] objs)
        {
            Dictionary <int, MissionInfo> curMission    = MissionLogic.GetInstance().GetCurrentMissionList();
            Dictionary <int, MissionInfo> canGetMission = MissionLogic.GetInstance().GetCanAcceptList();

            CollectObjLogic.GetInstance().ClearNeedCollectObjList();

            foreach (MissionInfo info in curMission.Values)
            {
                if (info.type == (int)MissionInfo.MissionType.MainMission)
                {
                    MissionName.text = info.questName;
                    MissionDes.text  = info.desc;
                    MissionCon.transform.localPosition   = MissionDes.transform.localPosition + new Vector3(0, -MissionDes.printedSize.y - 10, 0);
                    FeixieButton.transform.localPosition = new Vector3(FeixieButton.transform.localPosition.x, MissionCon.transform.localPosition.y - 6, 0);
                    if (info.curStatus == MissionInfo.MisssionStatus.BeenAccepted)
                    {
                        MissionCon.text = info.condition + " <FF0000>(未完成)<->";
                    }
                    else if (info.curStatus == MissionInfo.MisssionStatus.Finish)
                    {
                        KHeroSetting npcInfo = NpcLogic.GetInstance().GetNpcLocalInfo(info.submitNpcID);
                        // 要加个" " 不然颜色变化会错乱
                        MissionCon.text = " " + "<a:" + info.submitNpcID + ">" + "去找" + npcInfo.Name + "</a>" + " <ffa200>(已完成)<->";
                    }
                    mainInfo = info;
                }
            }

            foreach (MissionInfo info in canGetMission.Values)
            {
                if (info.type == (int)MissionInfo.MissionType.MainMission)
                {
                    MissionName.text = info.questName;
                    MissionDes.text  = info.desc;
                    MissionCon.transform.localPosition   = MissionDes.transform.localPosition + new Vector3(0, -MissionDes.printedSize.y - 10, 0);
                    FeixieButton.transform.localPosition = new Vector3(FeixieButton.transform.localPosition.x, MissionCon.transform.localPosition.y - 6, 0);
                    KHeroSetting npcInfo = NpcLogic.GetInstance().GetNpcLocalInfo(info.npcID);
                    MissionCon.text = "<a:" + info.npcID + ">" + "去找" + npcInfo.Name + "</a>";
                    mainInfo        = info;
                }
            }

            if (mainInfo != null)
            {
                if (mainInfo.curStatus == MissionInfo.MisssionStatus.BeenAccepted && mainInfo.subType == (int)MissionInfo.MissionSubType.Collect)
                {
                    int targetID;
                    if (TryGetIntIDFormString(mainInfo.condition, out targetID))
                    {
                        CollectObjLogic.GetInstance().AddNeedCollectObjID(targetID, mainInfo.id);
                    }
                }
            }

            return(null);
        }
        private void OnCollectBtnHandler(GameObject go)
        {
            MajorPlayer player = PlayerManager.GetInstance().MajorPlayer;

            m_fCollectTime = player.onlineTime;
            m_bBeCollect   = true;
            collectButton.SetActive(false);
            collectProgressBar.SetActive(true);
            ForegroundSprite.fillAmount = 0;

            CollectObjLogic.GetInstance().SendStartCollectObj(m_collectID, m_objID);
        }
        public void Open(int collectID, int objID)
        {
            Reset();
            m_collectID = collectID;
            m_objID     = objID;
            Show(true);

            if (CollectObjLogic.GetInstance().m_bAutoCollect&& bInited)
            {
                OnCollectBtnHandler(null);
            }
        }
        protected override void Init()
        {
            GameObject.DontDestroyOnLoad(viewGo);
            UIEventListener.Get(collectButton).onClick += OnCollectBtnHandler;

            bInited = true;

            if (CollectObjLogic.GetInstance().m_bAutoCollect)
            {
                OnCollectBtnHandler(null);
            }
        }
 public override void FixedUpdate()
 {
     if (m_bBeCollect)
     {
         KCollectMissionInfo info = KConfigFileManager.GetInstance().GetCollectInfo(m_collectID);
         if (info != null)
         {
             MajorPlayer player  = PlayerManager.GetInstance().MajorPlayer;
             float       timeUse = player.onlineTime - m_fCollectTime;
             if (timeUse < info.nNeedTime + 0.3f)
             {
                 ForegroundSprite.fillAmount = timeUse / (info.nNeedTime + 0.3f);
             }
             else
             {
                 CollectObjLogic.GetInstance().SendFinishCollectObj(m_collectID, CollectObjLogic.GetInstance().GetMissionIDByCollect(m_collectID));
                 m_bBeCollect = false;
             }
         }
     }
 }
        private object UpdateMission(params object[] objs)
        {
            Dictionary <int, MissionInfo> curMission    = MissionLogic.GetInstance().GetCurrentMissionList();
            Dictionary <int, MissionInfo> canGetMission = MissionLogic.GetInstance().GetCanAcceptList();

            attackItem.SetActive(false);
            daliyItem.SetActive(false);
            mainItem.SetActive(false);
            mainInfo   = null;
            daliyInfo  = null;
            attackInfo = null;
            CollectObjLogic.GetInstance().ClearNeedCollectObjList();

            foreach (MissionInfo info in curMission.Values)
            {
                if (info.type == (int)MissionInfo.MissionType.MainMission)
                {
                    MainMisName.text = info.questName;
                    if (info.curStatus == MissionInfo.MisssionStatus.BeenAccepted)
                    {
                        MainCondition.text = info.condition + " <FF0000>(未完成)<->";
                    }
                    else if (info.curStatus == MissionInfo.MisssionStatus.Finish)
                    {
                        KHeroSetting npcInfo = NpcLogic.GetInstance().GetNpcLocalInfo(info.submitNpcID);
                        MainCondition.text = " " + "<a:" + info.submitNpcID + ">" + "去找" + npcInfo.Name + "</a>" + " <ffa200>(已完成)<->";
                    }

                    mainInfo = info;
                    mainItem.SetActive(true);
                }
                else if (info.type == (int)MissionInfo.MissionType.DaliyMission)
                {
                    DaliyMisName.text = info.questName;
                    if (info.curStatus == MissionInfo.MisssionStatus.BeenAccepted)
                    {
                        DaliyCondition.text = info.condition + " <FF0000>(未完成)<->";
                    }
                    else if (info.curStatus == MissionInfo.MisssionStatus.Finish)
                    {
                        KHeroSetting npcInfo = NpcLogic.GetInstance().GetNpcLocalInfo(info.submitNpcID);
                        DaliyCondition.text = " " + "<a:" + info.submitNpcID + ">" + "去找" + npcInfo.Name + "</a>" + " <ffa200>(已完成)<->";
                    }

                    daliyInfo = info;
                    attackItem.SetActive(true);
                }
                else if (info.type == (int)MissionInfo.MissionType.SubLineMission)
                {
                    AttackMisName.text = info.questName;
                    if (info.curStatus == MissionInfo.MisssionStatus.BeenAccepted)
                    {
                        AttackCondition.text = info.condition + " <FF0000>(未完成)<->";
                    }
                    else if (info.curStatus == MissionInfo.MisssionStatus.Finish)
                    {
                        KHeroSetting npcInfo = NpcLogic.GetInstance().GetNpcLocalInfo(info.submitNpcID);
                        AttackCondition.text = " " + "<a:" + info.submitNpcID + ">" + "去找" + npcInfo.Name + "</a>" + " <ffa200>(已完成)<->";
                    }

                    attackInfo = info;
                    daliyItem.SetActive(true);
                }
            }

            foreach (MissionInfo info in canGetMission.Values)
            {
                if (info.type == (int)MissionInfo.MissionType.MainMission)
                {
                    MainMisName.text = info.questName;
                    KHeroSetting npcInfo = NpcLogic.GetInstance().GetNpcLocalInfo(info.npcID);
                    MainCondition.text = " " + "<a:" + info.npcID + ">" + "去找" + npcInfo.Name + "</a>";
                    mainInfo           = info;
                    mainItem.SetActive(true);
                    //ImmediateButtonLabel.text = "<a:" + info.id + ">" + ImmediateButtonLabel.text;
                }
                else if (info.type == (int)MissionInfo.MissionType.DaliyMission)
                {
                    DaliyMisName.text = info.questName;
                    KHeroSetting npcInfo = NpcLogic.GetInstance().GetNpcLocalInfo(info.npcID);
                    DaliyCondition.text = " " + "<a:" + info.npcID + ">" + "去找" + npcInfo.Name + "</a>";
                    daliyInfo           = info;
                    attackItem.SetActive(true);
                }
                else if (info.type == (int)MissionInfo.MissionType.SubLineMission)
                {
                    AttackMisName.text = info.questName;
                    KHeroSetting npcInfo = NpcLogic.GetInstance().GetNpcLocalInfo(info.npcID);
                    AttackCondition.text = " " + "<a:" + info.npcID + ">" + "去找" + npcInfo.Name + "</a>";
                    attackInfo           = info;
                    daliyItem.SetActive(true);
                }
            }

            if (mainInfo != null)
            {
                if (mainInfo.curStatus == MissionInfo.MisssionStatus.BeenAccepted && mainInfo.subType == (int)MissionInfo.MissionSubType.Collect)
                {
                    int targetID;
                    if (TryGetIntIDFormString(mainInfo.condition, out targetID))
                    {
                        CollectObjLogic.GetInstance().AddNeedCollectObjID(targetID, mainInfo.id);
                    }
                }
            }

            if (daliyInfo != null)
            {
                if (daliyInfo.curStatus == MissionInfo.MisssionStatus.BeenAccepted && daliyInfo.subType == (int)MissionInfo.MissionSubType.Collect)
                {
                    int targetID;
                    if (TryGetIntIDFormString(daliyInfo.condition, out targetID))
                    {
                        CollectObjLogic.GetInstance().AddNeedCollectObjID(targetID, daliyInfo.id);
                    }
                }
            }

            if (attackInfo != null)
            {
                if (attackInfo.curStatus == MissionInfo.MisssionStatus.BeenAccepted && attackInfo.subType == (int)MissionInfo.MissionSubType.Collect)
                {
                    int targetID;
                    if (TryGetIntIDFormString(attackInfo.condition, out targetID))
                    {
                        CollectObjLogic.GetInstance().AddNeedCollectObjID(targetID, attackInfo.id);
                    }
                }
            }

            return(null);
        }
 private void OnInterruptCollectRespond(int collectID, int resultCode)
 {
     CollectObjLogic.GetInstance().OnInterruptCollectRespond(collectID, resultCode);
 }