Example #1
0
    public void Init(RewardMisssionInfo rInfo)
    {
        m_missionInfo = rInfo;
        if (m_spriteIcon != null)
        {
            m_spriteIcon.spriteName = rInfo.strIcon;
        }

        if (m_labelName != null)
        {
            m_labelName.text = rInfo.strName;
        }

        if (m_labelExp != null)
        {
            table.QuestDataBase taskdb = GameTableManager.Instance.GetTableItem <table.QuestDataBase>(rInfo.ntaskid);
            if (taskdb != null)
            {
                m_labelExp.text = taskdb.dwRewardExp.ToString();
            }
        }

        if (m_goGet != null)
        {
            m_goGet.gameObject.SetActive(rInfo.nstate == (int)GameCmd.TokenTaskState.TOKEN_STATE_FINISH);
        }
        if (m_goDone != null)
        {
            m_goDone.SetActive(rInfo.nstate == (int)GameCmd.TokenTaskState.TOKEN_STATE_ACCEPT);
        }
        if (m_goProcessing != null)
        {
            m_goProcessing.SetActive(rInfo.nstate == (int)GameCmd.TokenTaskState.TOKEN_STATE_PUBLISH);
        }
    }
Example #2
0
    public void SetBottomUI()
    {
        if (m_labelCost != null)
        {
            if (TaskType == 1)
            {
                UpdateItemNum();
            }
            else if (TaskType == 2)
            {
                if (m_spriteCostIcon != null)
                {
                    m_spriteCostIcon.gameObject.SetActive(false);
                }
                if (m_labelCost != null)
                {
                    m_labelCost.gameObject.SetActive(false);
                }
                RewardMisssionInfo receiveReward = DataManager.Manager <TaskDataManager>().RewardMisssionData.receiveReward;
                if (receiveReward != null)
                {
                    if (receiveReward.id == m_AcceptTokenDataBase.id)
                    {
                        if (receiveReward.nstate == (uint)GameCmd.TokenTaskState.TOKEN_STATE_FINISH)
                        {
                            if (m_labelMissionNum != null)
                            {
                                m_labelMissionNum.gameObject.SetActive(true);
                                m_labelMissionNum.text = "已完成";
                            }

                            m_labelBtn.text = "领取奖励";
                        }
                        else if (receiveReward.nstate == (uint)GameCmd.TokenTaskState.TOKEN_STATE_ACCEPT)
                        {
                            if (m_labelMissionNum != null)
                            {
                                m_labelMissionNum.gameObject.SetActive(true);
                                m_labelMissionNum.text = "进行中";
                            }
                            m_labelBtn.text = "前 往";
                        }
                    }
                    else
                    {
                        SetReceiveUI();
                    }
                }
                else
                {
                    SetReceiveUI();
                }
            }
        }
    }
Example #3
0
    public void OnReceiveTokenTask(uint nTokenTaskID)
    {
        RewardMisssionInfo missioninfo = new RewardMisssionInfo();

        table.AcceptTokenDataBase reward = GameTableManager.Instance.GetTableItem <table.AcceptTokenDataBase>(nTokenTaskID);
        if (reward != null)
        {
            missioninfo.id      = reward.id;
            missioninfo.strIcon = reward.icon;
            missioninfo.strName = reward.title;
            missioninfo.nType   = 2;
            missioninfo.ntaskid = reward.taskid;
            table.QuestDataBase quest = GameTableManager.Instance.GetTableItem <table.QuestDataBase>(reward.taskid);
            if (quest != null)
            {
                missioninfo.nExp      = quest.dwRewardExp;
                missioninfo.nleftTime = quest.dwLimitTime * 60 * 60.0f;
            }
            missioninfo.nstate = (int)TokenTaskState.TOKEN_STATE_ACCEPT;
            m_RewardMisssionMgr.receiveReward = missioninfo;
            m_RewardMisssionMgr.RewardAcceptTimes++;

            //直接去做悬赏任务
            //GoToDoTokenTask();
            //延时去做悬赏任务(服务器的悬赏任务数据有可能还没下发)
            TimerAxis.Instance().KillTimer(TOKENTASK_TIMERID, this);
            TimerAxis.Instance().SetTimer(TOKENTASK_TIMERID, 200, this);
        }

        if (DataManager.Manager <UIPanelManager>().IsShowPanel(PanelID.RewardPanel))
        {
            //DataManager.Manager<UIPanelManager>().SendMsg(PanelID.RewardPanel, UIMsgID.eRewardTaskListRefresh, (int)nTokenTaskID);
            //策划要求直接关掉悬赏界面
            DataManager.Manager <UIPanelManager>().HidePanel(PanelID.RewardPanel);
        }

        //悬赏任务更新当前显示环数
        UpdateQuestTraceItemInfoByType(GameCmd.TaskType.TaskType_Token);
    }
Example #4
0
    [Execute]//发布令牌任务
    public void Excute(stPublicTokenTaskScriptUserCmd_CS cmd)
    {
        TaskDataManager taskMgr = DataManager.Manager <TaskDataManager>();

        RewardMisssionInfo missioninfo = new RewardMisssionInfo();

        table.PublicTokenDataBase reward = GameTableManager.Instance.GetTableItem <table.PublicTokenDataBase>(cmd.tokentaskid, 1);
        if (reward != null)
        {
            missioninfo.strIcon = reward.smallicon;
            missioninfo.strName = reward.title;
            missioninfo.nType   = 1;
            missioninfo.ntaskid = reward.taskid;
            missioninfo.id      = reward.id;
            table.QuestDataBase quest = GameTableManager.Instance.GetTableItem <table.QuestDataBase>(reward.taskid);
            if (quest != null)
            {
                missioninfo.nExp      = quest.dwRewardExp;
                missioninfo.nleftTime = quest.dwLimitTime * 60 * 60;
            }
            missioninfo.nstate = (int)TokenTaskState.TOKEN_STATE_PUBLISH;
            taskMgr.RewardMisssionData.ReleaseRewardList.Add(missioninfo);
        }
    }
Example #5
0
    /// <summary>
    /// 服务器下发数据初始化
    /// </summary>
    /// <param name="data"></param>
    /// <param name="acceptTaskRemain"></param>
    /// <param name="publicTaskRemain"></param>
    public void InitTask(List <GameCmd.TokenTaskInfo> data, uint acceptTaskRemain, uint publicTaskRemain)
    {
        RewardAcceptTimes  = acceptTaskRemain;//这里应当是已经接受的次数 下面也是
        RewardReleaseTimes = publicTaskRemain;
        ReleaseRewardList.Clear();
        receiveReward = null;
        RewardMisssionInfo missioninfo = null;

        for (int i = 0; i < data.Count; ++i)
        {
            missioninfo = new RewardMisssionInfo();
            //接受任务
            if (data[i].state > (int)GameCmd.TokenTaskState.TOKEN_STATE_FINISH)
            {
                table.AcceptTokenDataBase acceptData = GameTableManager.Instance.GetTableItem <table.AcceptTokenDataBase>(data[i].tokentaskid);
                if (acceptData != null)
                {
                    missioninfo.id      = acceptData.id;
                    missioninfo.strIcon = acceptData.icon;
                    missioninfo.strName = acceptData.title;
                    missioninfo.nType   = 2;
                    missioninfo.ntaskid = acceptData.taskid;
                    table.QuestDataBase quest = GameTableManager.Instance.GetTableItem <table.QuestDataBase>(acceptData.taskid);
                    if (quest != null)
                    {
                        missioninfo.nExp = quest.dwRewardExp;
                        long lpasstime = DateTimeHelper.Instance.Now - data[i].time;
                        missioninfo.nleftTime = quest.dwLimitTime * 60 * 60 - lpasstime;
                    }
                    missioninfo.nstate = (int)data[i].state;

                    QuestTraceInfo squest = QuestTranceManager.Instance.GetQuestTraceInfo(missioninfo.ntaskid);
                    if (squest != null)
                    {
                        missioninfo.nstate = squest.operate == squest.state ? (int)GameCmd.TokenTaskState.TOKEN_STATE_FINISH : (int)GameCmd.TokenTaskState.TOKEN_STATE_ACCEPT;
                    }
                    receiveReward = missioninfo;
                }
                continue;
            }

            table.PublicTokenDataBase reward = GameTableManager.Instance.GetTableItem <table.PublicTokenDataBase>(data[i].tokentaskid);
            if (reward != null)
            {
                missioninfo.id      = reward.id;
                missioninfo.strIcon = reward.smallicon;
                missioninfo.strName = reward.title;
                missioninfo.nType   = 1;
                missioninfo.ntaskid = reward.taskid;
                Engine.Utility.Log.LogGroup("ZCX", "id :" + data[i].tokentaskid);
                table.QuestDataBase quest = GameTableManager.Instance.GetTableItem <table.QuestDataBase>(reward.taskid);
                if (quest != null)
                {
                    missioninfo.nExp = quest.dwRewardExp;
                    long lpasstime = DateTimeHelper.Instance.Now - data[i].time;
                    missioninfo.nleftTime = quest.dwLimitTime * 60 * 60 - lpasstime;
                }
                missioninfo.nstate = (int)data[i].state;
                ReleaseRewardList.Add(missioninfo);
            }
        }
        if (DataManager.Manager <UIPanelManager>().IsShowPanel(PanelID.RewardPanel))
        {
            DataManager.Manager <UIPanelManager>().SendMsg(PanelID.RewardPanel, UIMsgID.eRewardTaskListRefresh, null);
        }
        else
        {
            for (int i = 0; i < ReleaseRewardList.Count; i++)
            {
                if (ReleaseRewardList[i].nstate == (int)GameCmd.TokenTaskState.TOKEN_STATE_FINISH && true == DataManager.Manager <TaskDataManager>().FirstLoginSuccess)
                {
                    DataManager.Manager <FunctionPushManager>().AddSysMsg(new PushMsg()
                    {
                        msgType  = PushMsg.MsgType.TokenTaskReward,
                        senderId = Client.ClientGlobal.Instance().MainPlayer.GetID(), //m_leaderId,
                        //senderId = cmd.dwAnswerUserID,
                        //name = cmd.byTeamName,
                        //sendName = cmd.byAnswerName,
                        sendTime = UnityEngine.Time.realtimeSinceStartup,
                        cd       = 100000,
                    });
                }
            }
        }

        if (DataManager.Manager <UIPanelManager>().IsShowPanel(PanelID.RewardMissionPanel))
        {
            DataManager.Manager <UIPanelManager>().SendMsg(PanelID.RewardMissionPanel, UIMsgID.eRewardTaskListRefresh, null);
        }

        //悬赏任务更新当前显示环数
        UpdateQuestTraceItemInfoByType(GameCmd.TaskType.TaskType_Token);
    }
Example #6
0
    void OnBtnClick(GameObject go)
    {
        int nlevel = Client.ClientGlobal.Instance().MainPlayer.GetProp((int)Client.CreatureProp.Level);

        if (TaskType == 1)
        {
            int itemNum = DataManager.Manager <ItemManager>().GetItemNumByBaseId(m_PublicTokenDataBase.tokenItemid);
            if (itemNum >= COSTNUM || m_parent.IsUseMoney())
            {
                //发布
                NetService.Instance.Send(new GameCmd.stPublicTokenTaskScriptUserCmd_CS()
                {
                    tokentaskid = m_PublicTokenDataBase.id,
                    userid      = Client.ClientGlobal.Instance().MainPlayer.GetID(),
                    isusemoney  = m_parent.IsUseMoney() ? (uint)1 : 0,
                });
            }
            else
            {
                DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.GetWayPanel, data: m_PublicTokenDataBase.tokenItemid);
            }
        }
        else if (TaskType == 2)
        {
            RewardMisssionInfo receiveReward = DataManager.Manager <TaskDataManager>().RewardMisssionData.receiveReward;
            if (receiveReward != null)
            {
                if (receiveReward.id == m_AcceptTokenDataBase.id)
                {
                    if (receiveReward.nstate == (uint)GameCmd.TokenTaskState.TOKEN_STATE_ACCEPT)
                    {
                        /* DataManager.Manager<UIPanelManager>().HidePanel(PanelID.RewardPanel);
                         * DataManager.Manager<UIPanelManager>().HidePanel(PanelID.DailyPanel);
                         *
                         * Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.TASK_DONING,
                         * new Client.stDoingTask() { taskid = receiveReward.ntaskid });*/

                        //去做任务
                        GoToDoTask(receiveReward.ntaskid);
                    }
                    else if (receiveReward.nstate == (uint)GameCmd.TokenTaskState.TOKEN_STATE_FINISH)
                    {
                        NetService.Instance.Send(new GameCmd.stAcceptTokenTaskFinishScriptUserCmd_C()
                        {
                            tokentaskid = receiveReward.id,
                            //userid = Client.ClientGlobal.Instance().MainPlayer.GetID(),
                        });
                        NetService.Instance.Send(new GameCmd.stGetTokenTaskNumScriptUserCmd_CS());
                    }
                }
                else
                {
                    //接取
                    AcceptTokenTask();
                }
            }
            else
            {
                AcceptTokenTask();
            }
        }
    }
Example #7
0
    public void InitUI(RewardMisssionInfo dataInfo, int ntype, RewardPanel parent)
    {
        m_parent   = parent;
        m_dataInfo = dataInfo;
        if (dataInfo == null)
        {
            if (m_GoNoAccess_status != null)
            {
                m_GoNoAccess_status.SetActive(ntype == 2);
            }

            if (m_GoNoRelease_status != null)
            {
                m_GoNoRelease_status.SetActive(ntype == 1);
            }

            if (m_GoReleasing_status != null)
            {
                m_GoReleasing_status.SetActive(false);
            }
            return;
        }


        if (m_spriteIcon != null)
        {
            m_spriteIcon.spriteName = dataInfo.strIcon;
        }

        if (m_lableExp != null)
        {
            m_lableExp.text = dataInfo.nExp.ToString();
        }
        if (m_lableName != null)
        {
            m_lableName.text = dataInfo.strName;
        }

        ntype = (int)dataInfo.nType;

        Debug.Log("nType :" + ntype);
        if (m_dataInfo.nleftTime > 0)
        {
            m_lableTime.text = GetLeftTime((int)m_dataInfo.nleftTime);
        }
        if (!m_bsetTimer)
        {
            m_bsetTimer = true;
            Engine.Utility.TimerAxis.Instance().SetTimer(TIMER_ID, 1000, this);
        }
        if (m_GoNoAccess_status != null)
        {
            m_GoNoAccess_status.SetActive(false);
        }

        if (m_GoNoRelease_status != null)
        {
            m_GoNoRelease_status.SetActive(false);
        }

        if (m_GoReleasing_status != null)
        {
            m_GoReleasing_status.SetActive(true);
        }


        if (ntype == 1)
        {
            bool active = dataInfo.nstate == (int)GameCmd.TokenTaskState.TOKEN_STATE_PUBLISH || dataInfo.nstate == (int)GameCmd.TokenTaskState.TOKEN_STATE_ACCEPT;
            if (m_GoReleasing != null)
            {
                m_GoReleasing.SetActive(active);
                if (m_lableReleasing != null)
                {
                    m_lableReleasing.enabled = active;
                    if (dataInfo.nstate == (int)GameCmd.TokenTaskState.TOKEN_STATE_ACCEPT)
                    {
                        m_lableReleasing.text = "被接取";
                    }
                    else if (dataInfo.nstate == (int)GameCmd.TokenTaskState.TOKEN_STATE_PUBLISH)
                    {
                        m_lableReleasing.text = "发布中";
                    }
                }
            }
            if (m_GoReleaseEnd != null)
            {
                m_GoReleaseEnd.SetActive(dataInfo.nstate == 3);
            }
        }
        else
        {
            if (m_GoReleasing != null)
            {
                m_GoReleasing.SetActive(dataInfo.nstate == (int)GameCmd.TokenTaskState.TOKEN_STATE_ACCEPT);
            }
            if (m_GoReleaseEnd != null)
            {
                m_GoReleaseEnd.SetActive(dataInfo.nstate == (int)GameCmd.TokenTaskState.TOKEN_STATE_FINISH);
            }
            if (m_lableReleasing != null)
            {
                m_lableReleasing.enabled = false;
            }
            if (m_btnGiveUp != null)
            {
                m_btnGiveUp.SetActive(dataInfo.nstate != 3);
            }
        }
    }