예제 #1
0
    public Client.INPC GetNPCByTraceInfo(QuestTraceInfo questInfo)
    {
        if (null == questInfo)
        {
            return(null);
        }
        Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem();
        if (es == null)
        {
            Engine.Utility.Log.Error("实体系统为null");
            return(null);
        }

        GameCmd.TaskProcess process = questInfo.GetTaskProcess();


        uint npcid    = 0;
        uint effectID = 0;

        if (process == GameCmd.TaskProcess.TaskProcess_None)//可接
        {
            npcid = questInfo.beginNpc;
        }
        else if (process == GameCmd.TaskProcess.TaskProcess_CanDone)
        {
            npcid = questInfo.endNpc;
        }
        else if (process == GameCmd.TaskProcess.TaskProcess_Doing)
        {
            npcid = questInfo.endNpc;
        }
        Client.INPC npc = es.FindNPCByBaseId((int)npcid);
        return(npc);
    }
예제 #2
0
    public void UpdateTaskOperate(uint nTaskID, uint nOperate)
    {
        QuestTraceInfo quest = QuestTranceManager.Instance.GetQuestTraceInfo(nTaskID);

        if (quest == null)
        {
            Engine.Utility.Log.Error("GET QuestTrace is null {0}", nTaskID);
            return;
        }
        quest.operate = nOperate;
        {
            quest.time = UnityEngine.Time.realtimeSinceStartup;
            //必须刷新追踪描述 才能做下一步
            quest.UpdateDesc();
            if (quest.GetTaskProcess() == TaskProcess.TaskProcess_CanDone)
            {
                Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.TASK_CANSUBMIT,
                                                                    new Client.stTaskCanSubmit()
                {
                    taskid = nTaskID, desc = quest.strDesc, state = quest.state, oprate = quest.operate
                });
            }

            if (DataManager.Manager <UIPanelManager>().IsShowPanel(PanelID.MissionAndTeamPanel))
            {
                DataManager.Manager <UIPanelManager>().SendMsg(PanelID.MissionAndTeamPanel, UIMsgID.eTask_Refresh_QuestInfo, nTaskID);
            }
        }
    }
예제 #3
0
 /*
  * /// <summary>
  * ///
  * /// </summary>
  * /// <param name="exp"></param>
  * /// <param name="money">文钱</param>
  * /// <param name="gold">金币</param>
  * /// <param name="itemIds"></param>
  * /// <param name="itemNums"></param>
  * private void SetNormalReward(uint exp,uint money,uint gold,List<uint> itemIds,List<uint> itemNums)
  * {
  *
  *  UIItemShow itemShow = null;
  *  int index = 0;
  *  if (exp > 0)
  *  {
  *      itemShow = index >= m_lstItem.Count ? GetItem() : m_lstItem[index];
  *      itemShow.gameObject.SetActive(true);
  *      itemShow.ShowWithItemIdNum(MainPlayerHelper.ExpID, exp);
  *      itemShow.transform.localPosition = new UnityEngine.Vector3(index * 90, 0, 0);
  *      index++;
  *  }
  *  if (money > 0)//文钱
  *  {
  *      itemShow = index >= m_lstItem.Count ? GetItem() : m_lstItem[index];
  *      itemShow.gameObject.SetActive(true);
  *      itemShow.ShowWithItemIdNum(MainPlayerHelper.MoneyTicketID, money);
  *      itemShow.transform.localPosition = new UnityEngine.Vector3(index * 90, 0, 0);
  *      index++;
  *  }
  *  if (gold > 0)//金币
  *  {
  *      itemShow = index >= m_lstItem.Count ? GetItem() : m_lstItem[index];
  *      itemShow.gameObject.SetActive(true);
  *      itemShow.ShowWithItemIdNum(MainPlayerHelper.GoldID, gold);
  *      itemShow.transform.localPosition = new UnityEngine.Vector3(index * 90, 0, 0);
  *      index++;
  *  }
  *
  *  for (int i = 0; i < itemIds.Count && i < itemNums.Count; ++i)
  *  {
  *      uint itembaseid = itemIds[i];
  *      uint itemNum = itemNums[i];
  *
  *      itemShow = index >= m_lstItem.Count ? GetItem() : m_lstItem[index];
  *      itemShow.gameObject.SetActive(true);
  *
  *      itemShow.ShowWithItemIdNum(itembaseid, itemNum);
  *      itemShow.transform.localPosition = new UnityEngine.Vector3(index * 90, 0, 0);
  *      index++;
  *  }
  *
  *  for (int i = index; i < m_lstItem.Count; i++)
  *  {
  *      m_lstItem[i].gameObject.SetActive(false);
  *  }
  *  m_trans_itemRoot.parent.GetComponent<UIScrollView>().ResetPosition();
  * }
  */
 private void SetTargetLabel(QuestTraceInfo taskInfo, ref table.QuestDataBase quest, ref UILabel targetLable)
 {
     if (taskInfo != null)
     {
         if (taskInfo.taskSubType == TaskSubType.Collection ||
             taskInfo.taskSubType == TaskSubType.KillMonster ||
             taskInfo.taskSubType == TaskSubType.KillMonsterCollect ||
             taskInfo.taskSubType == TaskSubType.DeliverItem)
         {
             GameCmd.TaskProcess process = taskInfo.GetTaskProcess();
             if (process == TaskProcess.TaskProcess_CanDone)
             {
                 targetLable.text = string.Format("{0}[00ff00]({1}/{2})", quest.dwStrTarget, taskInfo.operate, taskInfo.state);
             }
             else if (process == TaskProcess.TaskProcess_Doing)
             {
                 targetLable.text = string.Format("{0}[ff0000]({1}/{2})", quest.dwStrTarget, taskInfo.operate, taskInfo.state);
             }
             else
             {
                 targetLable.text = quest.dwStrTarget;
             }
         }
         else
         {
             targetLable.text = quest.dwStrTarget;
         }
     }
     else
     {
         targetLable.text = quest.dwStrTarget;
     }
 }
예제 #4
0
    //static uint nProcessTaskID = 0;
    public void ProcessTask(QuestTraceInfo taskInfo)
    {
        //nProcessTaskID = taskInfo.taskId;

        if (taskInfo == null)
        {
            Engine.Utility.Log.Error("taskInfo is null");
            return;
        }

        GameCmd.TaskProcess process = taskInfo.GetTaskProcess();
        if (process == GameCmd.TaskProcess.TaskProcess_None)//去接任务
        {
            StopRobot();
            DoAcceptTask(taskInfo);
        }
        else if (process == GameCmd.TaskProcess.TaskProcess_Doing)
        {
            StopRobot();

            OnDoingTask(taskInfo);
        }
        else if (process == GameCmd.TaskProcess.TaskProcess_CanDone)
        {
            StopRobot();

            OnCommitTask(taskInfo);
            return;
        }
    }
예제 #5
0
    void InitBtnIcon(GameObject btn, uint btnTaskId)
    {
        Transform iconTransf = btn.transform.Find("Icon");

        if (iconTransf == null)
        {
            return;
        }

        if (btnTaskId == 0)
        {
            iconTransf.gameObject.SetActive(false);
            return;
        }
        else
        {
            iconTransf.gameObject.SetActive(true);
        }

        UISprite iconSp = iconTransf.GetComponent <UISprite>();

        if (iconSp == null)
        {
            iconSp = iconTransf.gameObject.AddComponent <UISprite>();
        }

        List <QuestTraceInfo> traceTask;

        DataManager.Manager <TaskDataManager>().GetAllQuestTraceInfo(out traceTask);
        if (traceTask != null)
        {
            QuestTraceInfo questTraceInfo = traceTask.Find((data) => { return(btnTaskId == data.taskId); });
            if (questTraceInfo != null)
            {
                GameCmd.TaskProcess taskProcess = questTraceInfo.GetTaskProcess();
                if (taskProcess == GameCmd.TaskProcess.TaskProcess_None) //可接
                {
                    iconSp.spriteName = "tubiao_renwu_1";
                }
                else if (taskProcess == GameCmd.TaskProcess.TaskProcess_Doing)//执行中
                {
                    iconSp.spriteName = "tubiao_renwu_4";
                }
                else if (taskProcess == GameCmd.TaskProcess.TaskProcess_CanDone)//可以交付
                {
                    iconSp.spriteName = "tubiao_renwu_3";
                }
            }
            else
            {
                iconTransf.gameObject.SetActive(false);
            }
        }
        else
        {
            iconTransf.gameObject.SetActive(false);
        }
    }
예제 #6
0
    void CanDoneBtn()
    {
        QuestTraceInfo taskInfo = QuestTranceManager.GetInstance().GetQuestTraceInfo(m_nTaskid);

        if (taskInfo == null)
        {
            Engine.Utility.Log.Error(" No Found taskindo id {0}", m_nTaskid);
            return;
        }

        TaskProcess process = taskInfo.GetTaskProcess();

        if (process == TaskProcess.TaskProcess_CanDone)
        {
            onClick_Btn_bottom_Btn(null);
        }
    }
예제 #7
0
    private void SetBottomBtnLable(QuestTraceInfo taskInfo)
    {
        TaskProcess process = taskInfo.GetTaskProcess();

        if (process == TaskProcess.TaskProcess_None)
        {
            m_label_btn_bottom_Label.text = "接取";
        }
        else if (process == TaskProcess.TaskProcess_Doing)
        {
            m_label_btn_bottom_Label.text = "放弃";
        }
        else if (process == TaskProcess.TaskProcess_CanDone)
        {
            //开启自动完成
            if (taskInfo.QuestTable.dwAutoCanDone)
            {
                TimerAxis.Instance().KillTimer(MISSIONCANDONE_TIMER, this);
                TimerAxis.Instance().SetTimer(MISSIONCANDONE_TIMER, 1000, this);

                missionCanDoneBtnCd = CONST_MissionCanDoneBtnCd;
                string btnDes = string.Format("完成({0})", missionCanDoneBtnCd);
                m_label_btn_bottom_Label.text = btnDes;
            }
            else
            {
                if (TimerAxis.Instance().IsExist(MISSIONCANDONE_TIMER, this))
                {
                    TimerAxis.Instance().KillTimer(MISSIONCANDONE_TIMER, this);
                }
                m_label_btn_bottom_Label.text = "完成";
            }
            UIParticleWidget p = m_btn_btn_bottom.GetComponent <UIParticleWidget>();
            if (p == null)
            {
                p       = m_btn_btn_bottom.gameObject.AddComponent <UIParticleWidget>();
                p.depth = 20;
            }
            if (p != null)
            {
                p.SetDimensions(260, 54);
                p.ReleaseParticle();
                p.AddRoundParticle();
            }
        }
    }
예제 #8
0
    void onClick_Btn_bottom_Btn(GameObject caster)
    {
        this.HideSelf();
        QuestTraceInfo taskInfo = QuestTranceManager.GetInstance().GetQuestTraceInfo(m_nTaskid);

        if (taskInfo == null)
        {
            Engine.Utility.Log.Error(" No Found taskindo id {0}", m_nTaskid);
            return;
        }

        if (taskInfo.Received)
        {
            TaskProcess process = taskInfo.GetTaskProcess();
            if (taskInfo.taskSubType == TaskSubType.Guild)
            {
                if (process == TaskProcess.TaskProcess_CanDone)
                {
                    if (CanPutInKanpsack())
                    {
                        Protocol.Instance.RequestFinishTask(m_nTaskid);
                    }
                }
            }
            else
            {
                if (process == TaskProcess.TaskProcess_Doing)
                {
                    Protocol.Instance.RequestDelTask(m_nTaskid);
                }
                else if (process == TaskProcess.TaskProcess_CanDone)
                {
                    if (CanPutInKanpsack())
                    {
                        Protocol.Instance.RequestDialogSelect(1, m_strStep);
                    }
                }
            }
        }
        else
        {
            Protocol.Instance.RequestDialogSelect(1, m_strStep);
        }
    }
예제 #9
0
    void SetNpcTipsByTraceInfo(QuestTraceInfo questInfo)
    {
        Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem();
        if (es == null)
        {
            Engine.Utility.Log.Error("实体系统为null");
            return;
        }

        GameCmd.TaskProcess process = questInfo.GetTaskProcess();


        uint npcid    = 0;
        uint effectID = 0;

        if (process == GameCmd.TaskProcess.TaskProcess_None)//可接
        {
            npcid    = questInfo.beginNpc;
            effectID = EFFECT_CANACCEPT;
        }
        else if (process == GameCmd.TaskProcess.TaskProcess_CanDone)
        {
            npcid    = questInfo.endNpc;
            effectID = EFFECT_CANCOMMIT;
        }
        else if (process == GameCmd.TaskProcess.TaskProcess_Doing)
        {
            npcid    = questInfo.endNpc;
            effectID = EFFECT_DOING;
        }

        Client.INPC npc = es.FindNPCByBaseId((int)npcid);

        if (npc == null)
        {
            Engine.Utility.Log.Info("查找不到npc{0}", npcid);
            return;
        }

        AddNpcTip(npc, effectID, questInfo.taskId, process);
    }
예제 #10
0
    /// <summary>
    /// 获取任务当前状态
    /// </summary>
    /// <param name="taskId"></param>
    /// <returns></returns>
    private GuideDefine.TaskSubTriggerType GetTaskStatus(uint taskId)
    {
        GuideDefine.TaskSubTriggerType status = GuideDefine.TaskSubTriggerType.Invalid;
        QuestTraceInfo quest = QuestTranceManager.Instance.GetQuestTraceInfo(taskId);

        if (null != quest && quest.Received)
        {
            switch (quest.GetTaskProcess())
            {
            case GameCmd.TaskProcess.TaskProcess_Doing:
                status = GuideDefine.TaskSubTriggerType.Doing;
                break;

            case GameCmd.TaskProcess.TaskProcess_CanDone:
                status = GuideDefine.TaskSubTriggerType.CanSubmit;
                break;

            case GameCmd.TaskProcess.TaskProcess_Done:
                status = GuideDefine.TaskSubTriggerType.Complete;
                break;
            }
        }
        else
        {
            List <QuestTraceInfo> canAcceptTasks = new List <QuestTraceInfo>();
            DataManager.Manager <TaskDataManager>().GetCanReceiveQuest(ref canAcceptTasks);
            if (null != canAcceptTasks)
            {
                for (int i = 0; i < canAcceptTasks.Count; i++)
                {
                    if (canAcceptTasks[i].taskId == taskId)
                    {
                        status = GuideDefine.TaskSubTriggerType.CanAccept;
                        break;
                    }
                }
            }
        }
        return(status);
    }
예제 #11
0
    bool IsNeedSetTip(Client.INPC en, ref List <QuestTraceInfo> traceTask, out int index)
    {
        index = -1;
        if (en == null)
        {
            return(false);
        }

        if (en.IsMonster())
        {
            return(false);
        }
        QuestTraceInfo tranceInfo = null;

        GameCmd.TaskProcess process = GameCmd.TaskProcess.TaskProcess_Max;
        for (int i = 0; i < traceTask.Count; i++)
        {
            int npcid = en.GetProp((int)Client.EntityProp.BaseID);
            tranceInfo = traceTask[i];
            process    = tranceInfo.GetTaskProcess();
            if (process == GameCmd.TaskProcess.TaskProcess_None)
            {
                if (tranceInfo.beginNpc == npcid)
                {
                    index = i;
                    return(true);
                }
            }
            else if (process == GameCmd.TaskProcess.TaskProcess_CanDone ||
                     process == GameCmd.TaskProcess.TaskProcess_Doing)
            {
                if (tranceInfo.endNpc == npcid)
                {
                    index = i;
                    return(true);
                }
            }
        }
        return(false);
    }
예제 #12
0
    /// <summary>
    /// 尝试获取npc任务信息
    /// </summary>
    /// <param name="entity"></param>
    /// <param name="info"></param>
    /// <returns></returns>
    public static bool TryGetNPCTraceInfo(IEntity entity, out QuestTraceInfo info)
    {
        info = null;
        if (null == entity || entity.GetEntityType() != EntityType.EntityType_NPC /* || !(entity is Client.INPC)*/)
        {
            return(false);
        }
        //INPC npc = (INPC)entity;
        //if (npc.IsMonster())
        //    return null;
        List <QuestTraceInfo> traceTask;

        DataManager.Manager <TaskDataManager>().GetAllQuestTraceInfo(out traceTask);

        int npcBaseID = entity.GetProp((int)Client.EntityProp.BaseID);

        GameCmd.TaskProcess process = GameCmd.TaskProcess.TaskProcess_Max;
        for (int i = 0; i < traceTask.Count; i++)
        {
            info    = traceTask[i];
            process = info.GetTaskProcess();
            if (process == GameCmd.TaskProcess.TaskProcess_CanDone ||
                process == GameCmd.TaskProcess.TaskProcess_Doing)
            {
                if (info.endNpc == npcBaseID)
                {
                    return(true);
                }
            }
            else if (process == GameCmd.TaskProcess.TaskProcess_None)
            {
                if (info.beginNpc == npcBaseID)
                {
                    return(true);
                }
            }
        }
        return(false);
    }
예제 #13
0
    public static bool TryGetQuestStatusIcon(QuestTraceInfo info, out long uid, out string icon)
    {
        icon = string.Empty;
        uid  = 0;
        if (null == info)
        {
            return(false);
        }

        GameCmd.TaskProcess process = info.GetTaskProcess();

        uint npcid = 0;

        icon = GetQuestStatusIcon(process);
        if (process == GameCmd.TaskProcess.TaskProcess_CanDone)
        {
            npcid = info.endNpc;
        }
        else if (process == GameCmd.TaskProcess.TaskProcess_None)//可接
        {
            npcid = info.beginNpc;
        }
        else if (process == GameCmd.TaskProcess.TaskProcess_Doing)
        {
            npcid = info.endNpc;
        }

        Client.INPC npc = GetNPCByBaseID(npcid);
        if (npc == null)
        {
            Engine.Utility.Log.Info("查找不到npc{0}", npcid);
            return(false);
        }
        uid = npc.GetUID();
        return(true);
    }
예제 #14
0
    public void UpdateUI(QuestTraceInfo taskInfo)
    {
        //if (m_xmlText == null || m_widght == null || taskInfo == null)
        if (m_lblText == null || m_widght == null || taskInfo == null)
        {
            return;
        }

        if (m_taskInfo != null && (m_taskInfo.taskId != taskInfo.taskId || m_taskInfo.dynamicTranceUpdate))
        {
            m_bShow = false;
            m_taskInfo.dynamicTranceUpdate = false;
        }
        m_taskInfo = taskInfo;
        //如果已经显示 并且状态没发生变化 不刷新UI
        if (m_bShow && m_nPreState == m_taskInfo.state && m_nPreOpreate == m_taskInfo.operate && m_taskInfo.taskType != TaskType.TaskType_Token)
        {
            return;
        }
        m_bShow       = true;
        m_nPreState   = m_taskInfo.state;
        m_nPreOpreate = m_taskInfo.operate;

        string tempstring = taskInfo.strDesc;

        GameCmd.TaskProcess process = taskInfo.GetTaskProcess();

        m_nHeight = 0;
        if (m_labelTitle != null)
        {
            m_labelTitle.text = taskInfo.StrFormatName;
            m_nHeight         = m_labelTitle.height + 8;
        }
        if (m_labelState != null)
        {
            m_labelState.text = taskInfo.StrState;
        }
        //m_xmlText.Clear();
        //m_xmlText.fontSize = 20;

        //m_xmlText.AddXml(RichXmlHelper.RichXmlAdapt(tempstring));

        m_lblText.fontSize = 20;
        m_lblText.text     = tempstring;

        //m_widght.height = m_nHeight + m_xmlText.host.height + 8;
        m_widght.height = m_nHeight + m_lblText.height + 8;
        m_nHeight       = m_widght.height;

        if (taskInfo.taskType == TaskType.TaskType_Normal)
        {
            if (process == TaskProcess.TaskProcess_None)
            {
                SetEffect(false);
            }
            else if (process == TaskProcess.TaskProcess_CanDone)
            {
                SetEffect(true);
            }
            else
            {
                SetEffect(false);
            }
        }
        else
        {
            SetEffect(false);
        }

        int depth = m_widght.depth + 1;
        //foreach (Transform widget in m_xmlText.transform)
        //{
        //    if (widget.GetComponent<BoxCollider>() != null)
        //    {
        //        widget.GetComponent<BoxCollider>().enabled = false;
        //    }
        //    widget.GetComponent<UIWidget>().depth = depth;
        //}
    }