示例#1
0
    //怪物出现的关卡
    private void SetMonShow(CooperationTask info)
    {
        m_monShowPlane.gameObject.SetActive(true);
        UIDynamicImage.LoadImage(m_monIcon, info.icon);
        Util.SetText(m_monDesc, info.desc);
        Util.SetText(m_monsterName, info.name);
        m_noApper.gameObject.SetActive(false);
        m_monsterView.gameObject.SetActive(false);

        if (moduleActive.CoopShowList.Count <= 0)
        {
            m_noApper.gameObject.SetActive(true);
        }
        else
        {
            m_monsterView.gameObject.SetActive(true);
            monsterData.SetItems(moduleActive.CoopShowList);
        }
    }
示例#2
0
    public void SetInfo(PCooperateInfo info, Action <CooperationTask> monShow)
    {
        if (info == null)
        {
            Logger.LogError("server info is null");
            return;
        }
        CooperationTask task = Module_Active.instance.coopTaskBase.Find(a => a.ID == info.taskId);

        if (task == null)
        {
            Logger.LogError("configuration is not have this id");
            return;
        }
        Get();
        monShowList = monShow;

        Util.SetText(m_name, task.name);
        if (string.IsNullOrEmpty(task.icon))
        {
            Logger.LogError(" this task no icon");
        }
        UIDynamicImage.LoadImage(m_monsterImg, task.icon);

        Util.SetText(m_invateTxt, ConfigText.GetDefalutString(223, 38), task.limitLevel);
        m_taskOne.gameObject.SetActive(true);
        m_coop.gameObject.SetActive(task.type == 1);
        m_taskTwo.gameObject.SetActive(task.type == 1);
        m_invate.gameObject.SetActive(info.friendId == 0 && task.type == 1 && info.state == 0);
        m_player.gameObject.SetActive(info.friendId != 0 && task.type == 1 && info.state == 0);
        m_reward.gameObject.SetActive(info.state == 1);
        m_offPlane.gameObject.SafeSetActive(info.state == 2);

        AwardGetSucced succed = m_showReward.GetComponentDefault <AwardGetSucced>();

        succed.SetAward(task.reward, showReward, false);

        if (task.conditions == null || task.conditions.Length < 1)
        {
            Logger.LogError("monster info is error");
            return;
        }
        if (task.type == 2 && task.conditions.Length >= 1)
        {
            SetValue(task.conditions[0], 0, m_oneTxt, m_oneSlider, m_oneValue, info.selfFinishVal);
        }
        else if (task.type == 1 && task.conditions.Length > 1)
        {
            var self      = task.conditions[0];
            var friend    = task.conditions[1];
            var ids       = info.friendId;
            var selfValue = info.selfFinishVal;
            var fValue    = info.assistFinishVal;
            if (Module_Player.instance.id_ != info.ownerId)
            {
                self      = task.conditions[1];
                friend    = task.conditions[0];
                ids       = info.ownerId;
                selfValue = info.assistFinishVal;
                fValue    = info.selfFinishVal;
            }
            SetValue(self, 0, m_oneTxt, m_oneSlider, m_oneValue, selfValue);
            SetValue(friend, 1, m_twoTxt, m_twoSlider, m_twoValue, fValue);
            if (ids != 0)
            {
                var f = Module_Friend.instance.FriendList.Find(a => a.roleId == ids);
                if (f != null)
                {
                    m_invateName.text = f.name;
                    headBoxFriend headBox = m_HeadBox.gameObject.GetComponentDefault <headBoxFriend>();
                    headBox.HeadBox(f.headBox);
                    Module_Avatar.SetClassAvatar(m_HeadAvatar, f.proto, false, f.gender);
                }
            }
        }
        m_invateBtn.onClick.RemoveAllListeners();
        m_invateBtn.onClick.AddListener(delegate
        {
            Module_Active.instance.CheckTaskID = info.uid;
            Module_Active.instance.GetCanInvate(info.taskId);
        });
        m_monsterBtn.onClick.RemoveAllListeners();
        m_monsterBtn.onClick.AddListener(delegate
        {
            //出现怪物详情界面
            if (!Module_Active.instance.collTask.ContainsKey(task.ID))
            {
                var idnex = 0;
                if (Module_Player.instance.id_ != info.ownerId)
                {
                    idnex = 1;
                }
                Module_Active.instance.GetMonsterShow(task.ID, task.conditions[idnex].monsterId);
            }
            Module_Active.instance.CoopShowList.Clear();
            Module_Active.instance.GetAllMonsterStage(task.ID);

            monShowList(task);
        });
        m_rewardBtn.onClick.RemoveAllListeners();
        m_rewardBtn.onClick.AddListener(delegate
        {
            Module_Active.instance.GetCoopReward(info.uid);
        });
        m_playerBtn.onClick.RemoveAllListeners();
        m_playerBtn.onClick.AddListener(delegate
        {
            if (Module_Player.instance.id_ != info.ownerId)
            {
                Module_Global.instance.ShowMessage(223, 46);                                            //无权踢出
            }
            else
            {
                if (CanKickedOut(info.acceptTime) && info.state == 0)
                {
                    Window_Alert.ShowAlert(ConfigText.GetDefalutString(223, 40), true, true, true, () =>
                    {
                        Module_Active.instance.KickedOutFriend(info.uid, info.friendId);
                    }, null, "", "");
                }
                else
                {
                    Module_Global.instance.ShowMessage(223, 43); //未到时间 或者 已经可领取
                }
            }
        });
    }