Exemple #1
0
    private void RefreshDoorsUI()
    {
        m_currentCopyId = -1;
        DoorOfBuryUIViewManager view = DoorOfBuryUIViewManager.Instance;

        Debug.Log("clear");
        view.ClearFriendList();
        Debug.Log("clear done");

        // ��������֮������
        view.SetGridNum(m_doorList.Count);

        // ��������֮��Grid
        if (m_doorList.Count > 0)
        {
            for (int i = 0; i < m_doorList.Count; ++i)
            {
                FriendGridData  fd   = new FriendGridData();
                DoorOfBurryData data = m_doorList[i];
                fd.Id = i;

                //Debug.LogError(data.leftTime);
                int leftTime = (int)data.leftTime;

                fd.hour  = leftTime / 3600;
                fd.minus = (leftTime % 3600) / 60;
                //Debug.LogError("hour:" + fd.hour);
                //Debug.LogError("minus:" + fd.minus);
                //Debug.Log("data.progress:" + data.progress);
                fd.bossHP = (int)(data.progress * 100) + "";//* 100 + "%"

                fd.bossLevel = "     level:" + data.level;
                //fd.bossName = LanguageData.dataMap.Get(monster.hpShow.Get(1)).content;
                fd.bossName = data.bossName;
                //Debug.Log("bossName:" + fd.bossName);
                fd.name    = data.ownerName;
                fd.headImg = IconData.GetHeadImgByVocation(data.ownerVocation);
                Debug.Log(fd.headImg);

                fd.isHelp = false;
                fd.isKill = false;
                fd.isLose = false;
                fd.isWin  = false;

                switch ((int)data.killWay)
                {
                case (int)DoorOfBurryKillWay.Help:
                    fd.isHelp = true;
                    break;

                case (int)DoorOfBurryKillWay.Kill:
                    fd.isKill = true;
                    break;

                case (int)DoorOfBurryKillWay.None:
                    break;
                }

                //�������������
                fd.battleInfo = data.battleInfo;
                fd.isWin      = data.isWin;
                fd.isLose     = data.isLose;

                view.AddFriendListGrid(fd);
            }
        }


        int minute = CD / 60;

        if (minute > 0)
        {
            view.SetDoorTitle(LanguageData.GetContent(47110));// "����֮�ŷ�ӡ��"
            view.BeginCountDown(minute + 1);
        }
        else
        {
            view.SetDoorTitle(LanguageData.GetContent(47111));// "����֮��"
            view.ClearDoorCD();
        }

        if (MogoUIManager.Instance != null)
        {
            //MogoUIManager.Instance.ShowMogoCommuntiyUI(CommunityUIParent.NormalMainUI, false);

            MogoUIManager.Instance.m_CommunityUI.SetActive(false);
            NormalMainUIViewManager.Instance.ShowCommunityButton(true);
        }
    }
Exemple #2
0
    /*
     * <GuildResp>
     *  <Arg>UINT8</Arg>   -- id
     *  <Arg>UINT16</Arg>  --errCode
     *  <Arg>LUA_TABLE</Arg>
     * </GuildResp>
     */

    public void GuildResp(byte id, UInt16 errCode, LuaTable respInfo)
    {
        if (errCode != 0)
        {
            HandleErrorCode(errCode);
        }

        switch (id)
        {
        case MSG_GET_GUILDS:
            //应lua_table:({1=数量, 2={1={1=公会dbid,2=名称,3=等级,4=人数}, ...}})
            if (errCode == 0)
            {
                int tongNum = int.Parse((string)respInfo["1"]);

                m_listTongUIData.Clear();
                m_listTongData.Clear();

                for (int i = 0; i < tongNum; ++i)
                {
                    TongData temp = new TongData();

                    //uint.Parse((string)((LuaTable)((LuaTable)respInfo["2"])[i.ToString()])["1"]);
                    temp.dbid      = uint.Parse((string)((LuaTable)((LuaTable)respInfo["2"])[(i + 1).ToString()])["1"]);
                    temp.name      = (string)((LuaTable)((LuaTable)respInfo["2"])[(i + 1).ToString()])["2"];
                    temp.level     = int.Parse((string)((LuaTable)((LuaTable)respInfo["2"])[(i + 1).ToString()])["3"]);
                    temp.peopleNum = int.Parse((string)((LuaTable)((LuaTable)respInfo["2"])[(i + 1).ToString()])["4"]);

                    TongUIViewManager.TongData td = new TongUIViewManager.TongData();
                    td.level = temp.level.ToString();
                    td.name  = temp.name;
                    td.num   = temp.peopleNum.ToString();

                    m_listTongUIData.Add(td);
                    m_listTongData.Add(temp);
                }

                TongUIViewManager.Instance.SetTongList(m_listTongUIData);
                TongUIViewManager.Instance.ShowTongList();
            }
            break;

        case MSG_GET_GUILDS_COUNT:
            Debug.Log("获取公会数量返回");
            if (errCode == 0)
            {
                m_iTongNum = int.Parse((string)respInfo["1"]);

                GuildReq(MSG_GET_GUILDS, 1, (uint)m_iTongNum);

                Debug.Log("获取公会数量  " + m_iTongNum);
            }
            break;

        case MSG_CREATE_GUILD:
            if (errCode == 0)
            {
                //创建公会成功
                //le:({1=公会名, 2=公会人数, 3=公会职位})

                //m_strTongName = (string)respInfo["1"];
                //m_strTongPeopleNum = ((int)respInfo["2"]).ToString();

                GuildReq(MSG_GET_GUILD_INFO);
                Debug.Log("创建公会成功");
            }
            else
            {
                Debug.Log("创建公会失败 errCode = " + errCode);
            }
            break;

        case MSG_GET_GUILD_INFO:
            if (errCode == 0 && (string)respInfo["1"] != "")
            {
                //切换到公会详细界面
                m_strTongName = (string)respInfo["1"];
                GuildReq(MSG_GET_GUILD_DETAILED_INFO);
                IsShowMyTong = true;
                IsShowDragon = false;
                IsShowSkill  = false;

                Debug.Log("获取公会信息成功 " + errCode + " " + (string)respInfo["1"]);
            }
            //else if (errCode == ERROR_GET_GUILD_DETAILED_INFO_NO_GUILD)
            else
            {
                GuildReq(MSG_GET_GUILDS_COUNT);
                //切换到公会列表

                Debug.Log("获取公会信息失败 " + errCode);
            }
            break;

        case MSG_SET_GUILD_ANNOUNCEMENT:
            if (errCode == 0)
            {
                //修改公告成功
                GuildReq(MSG_GET_GUILD_ANNOUNCEMENT);
            }
            break;

        case MSG_GET_GUILD_ANNOUNCEMENT:
            if (errCode == 0)
            {
                m_strTongNotice = (string)respInfo["1"];

                TongUIViewManager.Instance.SetTongNotice(m_strTongNotice);
                //获取公告成功
            }
            break;

        case MSG_APPLY_TO_JOIN:
            if (errCode == 0)
            {
                //申请加入公会成功
                Debug.Log("尝试申请加入公会成功");
            }
            else
            {
                Debug.Log("尝试申请加入?崾О圻" + errCode);
            }
            break;

        case MSG_APPLY_TO_JOIN_NOTIFY:
            break;

        case MSG_GET_GUILD_DETAILED_INFO:
            if (errCode == 0)
            {
                //获取公会详细信息成功
                m_strTongNotice      = (string)respInfo["1"];
                m_strTongMoney       = (string)respInfo["2"];
                m_strTongLevel       = (string)respInfo["3"];
                m_strTongPeopleNum   = (string)respInfo["4"];
                m_strTongBossName    = (string)respInfo["5"];
                m_iCurrenDragonPower = int.Parse((string)respInfo["6"]);

                foreach (var item in GuildSkillData.dataMap)
                {
                    if (!m_dictSkillIDToLevel.ContainsKey(item.Value.type))
                    {
                        Debug.Log(item.Value.type.ToString() + " " + (LuaTable)respInfo["7"]);
                        m_dictSkillIDToLevel.Add(item.Value.type, int.Parse((string)((LuaTable)respInfo["7"])[item.Value.type.ToString()]));
                    }
                }

                TongUIViewManager.Instance.SetTitle(string.Concat(m_strTongName, "   Lv ", m_strTongLevel));
                TongUIViewManager.Instance.SetTongMoney("公会资金:" + m_strTongMoney);
                TongUIViewManager.Instance.SetTongNum("公会人数:" + m_strTongPeopleNum + "/" + GuildLevelData.dataMap[int.Parse(m_strTongLevel)].memberCount);
                TongUIViewManager.Instance.SetTongName("会长:" + m_strTongBossName);
                TongUIViewManager.Instance.SetTongNotice(m_strTongNotice);

                if (IsShowMyTong)
                {
                    TongUIViewManager.Instance.ShowMyTong();
                }
                else if (IsShowDragon)
                {
                    foreach (var item in GuildDragonData.dataMap)
                    {
                        if (item.Value.guild_level.ToString() == m_strTongLevel)
                        {
                            int diamond = item.Value.diamond_recharge_cost;
                            int gold    = item.Value.gold_recharge_cost;
                            TongUIViewManager.Instance.ShowDragonPower("88", m_iCurrenDragonPower, item.Value.dragon_limit, gold, diamond, diamond);
                            break;
                        }
                    }
                }
                else if (IsShowSkill)
                {
                    m_listTongSkillUIData.Clear();

                    foreach (var item in GuildSkillData.dataMap)
                    {
                        TongUIViewManager.TongSkillData data = new TongUIViewManager.TongSkillData();
                        data.cost    = item.Value.money.ToString();
                        data.effect1 = item.Value.add.ToString();
                        data.effect2 = item.Value.add.ToString();
                        //data.name = item.Value.type.ToString();

                        switch (item.Value.type)
                        {
                        case 1:
                            data.name = LanguageData.GetContent(48405);         // "攻击技能";
                            break;

                        case 2:
                            data.name = LanguageData.GetContent(48405);         // "防守技能";
                            break;

                        case 3:
                            data.name = LanguageData.GetContent(48405);         // "生命技能";
                            break;
                        }
                        data.starNum = m_dictSkillIDToLevel[item.Value.type];

                        m_listTongSkillUIData.Add(data);

                        m_listTongSkillType.Add(item.Value.type);
                    }

                    TongUIViewManager.Instance.SetSkillList(m_listTongSkillUIData);
                    TongUIViewManager.Instance.ShowSkillList();
                }
                else
                {
                    TongManager.Instance.GuildReq(TongManager.MSG_GET_GUILD_MEMBERS, 1,
                                                  uint.Parse(TongManager.Instance.m_strTongPeopleNum));
                }

                Debug.Log("获取公会详细信息成功");
            }
            else
            {
                Debug.Log("获取公会详细信息失败 " + errCode);
            }
            break;

        case MSG_GET_GUILD_MESSAGES_COUNT:
            if (errCode == 0)
            {
                int count = int.Parse((string)(respInfo["1"]));
                Debug.Log("获取公会请求信息数量成功 " + count);

                GuildReq(MSG_GET_GUILD_MESSAGES, 1, (uint)count, "1");
            }
            else
            {
                Debug.Log("获取公会请求信息数量失败 " + errCode);
            }
            break;

        case MSG_GET_GUILD_MESSAGES:
            if (errCode == 0)
            {
                m_listTongApplicantData.Clear();
                m_listTongApplicantUIData.Clear();

                int count = int.Parse((string)(respInfo["1"]));

                for (int i = 0; i < count; ++i)
                {
                    TongApplicantData data = new TongApplicantData();

                    data.dbid  = UInt64.Parse((string)((LuaTable)((LuaTable)respInfo["2"])[(i + 1).ToString()])["1"]);
                    data.name  = (string)((LuaTable)((LuaTable)respInfo["2"])[(i + 1).ToString()])["2"];
                    data.job   = int.Parse((string)((LuaTable)((LuaTable)respInfo["2"])[(i + 1).ToString()])["3"]);
                    data.level = int.Parse((string)((LuaTable)((LuaTable)respInfo["2"])[(i + 1).ToString()])["4"]);
                    data.power = int.Parse((string)((LuaTable)((LuaTable)respInfo["2"])[(i + 1).ToString()])["5"]);

                    m_listTongApplicantData.Add(data);

                    TongUIViewManager.ApplicantData uidata = new TongUIViewManager.ApplicantData();

                    uidata.name         = data.name;
                    uidata.level        = data.level.ToString();
                    uidata.power        = data.power.ToString();
                    uidata.vocationIcon = IconData.GetHeadImgByVocation(data.job);

                    m_listTongApplicantUIData.Add(uidata);
                }

                TongUIViewManager.Instance.SetApplicantList(m_listTongApplicantUIData);
                TongUIViewManager.Instance.ShowMyTongApplicantList();

                Debug.Log("获取公会请求列表成功 " + count);
            }
            else
            {
                Debug.Log("获取公会请求列表失败 " + errCode);
            }
            break;

        case MSG_ANSWER_APPLY:
            if (errCode == 0)
            {
                TongManager.Instance.GuildReq(TongManager.MSG_GET_GUILD_MESSAGES_COUNT, 1);
            }
            else
            {
                Debug.Log("回应申请失败 " + errCode);
            }
            break;

        case MSG_INVITE:
            if (errCode == 0)
            {
            }
            break;

        case MSG_INVITED:
            if (errCode == 0)
            {
            }
            break;

        case MSG_ANSWER_INVITE:
            if (errCode == 0)
            {
            }
            break;

        case MSG_APPLY_TO_JOIN_RESULT:
            if (errCode == 0)
            {
                //申请回应

                int result = int.Parse((string)respInfo["1"]);

                string tongName = (string)respInfo["2"];

                if (result == 0)
                {
                    MogoGlobleUIManager.Instance.Info(tongName + " JoinReq Success");
                    Debug.Log("申请成功");
                    GuildReq(MSG_GET_GUILD_INFO);
                }
                else
                {
                    MogoGlobleUIManager.Instance.Info(tongName + " JoinReq Fail");
                }
            }
            break;

        case MSG_QUIT:
            if (errCode == 0)
            {
            }
            break;

        case MSG_PROMOTE:
            if (errCode == 0)
            {
                Debug.Log("提升职位成功");
                TongManager.Instance.GuildReq(TongManager.MSG_GET_GUILD_DETAILED_INFO);
                TongManager.Instance.IsShowMyTong = false;
                TongManager.Instance.IsShowDragon = false;
                TongManager.Instance.IsShowSkill  = false;
                TongUIViewManager.Instance.ShowMemberControlPanel(false);
            }
            else
            {
                Debug.Log("提升职位失败 " + errCode);
            }
            break;

        case MSG_DEMOTE:
            if (errCode == 0)
            {
                Debug.Log("减低职位成功");
                TongManager.Instance.GuildReq(TongManager.MSG_GET_GUILD_DETAILED_INFO);
                TongManager.Instance.IsShowMyTong = false;
                TongManager.Instance.IsShowDragon = false;
                TongManager.Instance.IsShowSkill  = false;
                TongUIViewManager.Instance.ShowMemberControlPanel(false);
            }
            else
            {
                Debug.Log("减低职位失败 " + errCode);
            }
            break;

        case MSG_EXPEL:
            if (errCode == 0)
            {
                Debug.Log("开除成功");
                TongManager.Instance.GuildReq(TongManager.MSG_GET_GUILD_DETAILED_INFO);
                TongManager.Instance.IsShowMyTong = false;
                TongManager.Instance.IsShowDragon = false;
                TongManager.Instance.IsShowSkill  = false;
                TongUIViewManager.Instance.ShowMemberControlPanel(false);
            }
            else
            {
                Debug.Log("开除失败 " + errCode);
            }
            break;

        case MSG_DEMISE:
            if (errCode == 0)
            {
                Debug.Log("转让成功");
                TongManager.Instance.GuildReq(TongManager.MSG_GET_GUILD_DETAILED_INFO);
                TongManager.Instance.IsShowMyTong = false;
                TongManager.Instance.IsShowDragon = false;
                TongManager.Instance.IsShowSkill  = false;
                TongUIViewManager.Instance.ShowMemberControlPanel(false);
            }
            else
            {
                Debug.Log("转让失败 " + errCode);
            }
            break;

        case MSG_DISMISS:
            if (errCode == 0)
            {
            }
            break;

        case MSG_THAW:
            if (errCode == 0)
            {
            }
            break;

        case MSG_RECHARGE:
            if (errCode == 0)
            {
            }
            break;

        case MSG_GET_GUILD_MEMBERS:
            if (errCode == 0)
            {
                Debug.Log("获取公会成员列表成功");

                m_listTongMemberData.Clear();
                m_listTongMemberUIData.Clear();

                int count = respInfo.Count;

                for (int i = 0; i < count; ++i)
                {
                    TongUIViewManager.MemberData uidata = new TongUIViewManager.MemberData();
                    TongMemberData data = new TongMemberData();

                    data.dbid       = uint.Parse((string)((LuaTable)(respInfo[(i + 1).ToString()]))["1"]);
                    data.name       = (string)((LuaTable)(respInfo[(i + 1).ToString()]))["2"];
                    data.level      = int.Parse((string)((LuaTable)(respInfo[(i + 1).ToString()]))["3"]);
                    data.jobId      = int.Parse((string)((LuaTable)(respInfo[(i + 1).ToString()]))["4"]);
                    data.power      = int.Parse((string)((LuaTable)(respInfo[(i + 1).ToString()]))["5"]);
                    data.contribute = int.Parse((string)((LuaTable)(respInfo[(i + 1).ToString()]))["6"]);
                    data.date       = int.Parse((string)((LuaTable)(respInfo[(i + 1).ToString()]))["7"]);

                    m_listTongMemberData.Add(data);

                    uidata.name         = data.name;
                    uidata.level        = data.level.ToString();
                    uidata.contribution = data.contribute.ToString();
                    uidata.power        = data.power.ToString();
                    uidata.date         = Utils.GetTime(data.date).ToString("yyyy-MM-dd");

                    switch (data.jobId)
                    {
                    case 1:
                        uidata.position = LanguageData.GetContent(48400);         // "公会长";
                        break;

                    case 2:
                        uidata.position = LanguageData.GetContent(48401);         // "副会长1";
                        break;

                    case 3:
                        uidata.position = LanguageData.GetContent(48402);         // "副会长2";
                        break;

                    case 4:
                        uidata.position = LanguageData.GetContent(48403);         // "副会长3";
                        break;

                    default:
                        uidata.position = LanguageData.GetContent(48404);         // "普通成员";
                        break;
                    }

                    m_listTongMemberUIData.Add(uidata);

                    TongUIViewManager.Instance.SetMemberList(m_listTongMemberUIData);
                    TongUIViewManager.Instance.ShowMyTongMemberList();
                }
            }
            else
            {
                Debug.Log("获取公会成员列表失败 " + errCode);
            }
            break;

        case MSG_GET_DRAGON:
            if (errCode == 0)
            {
            }
            break;

        case MSG_UPGRADE_GUILD_SKILL:
            if (errCode == 0)
            {
            }
            break;

        case MSG_GET_RECOMMEND_LIST:
            if (errCode == 0)
            {
                Debug.Log("获取推荐列表成功");

                m_listTongPresenterUIData.Clear();
                m_listTongPresenterData.Clear();

                for (int i = 0; i < respInfo.Count; ++i)
                {
                    TongPresenterData data = new TongPresenterData();

                    data.dbid  = UInt64.Parse((string)((LuaTable)respInfo[(i + 1).ToString()])["1"]);
                    data.name  = (string)((LuaTable)respInfo[(i + 1).ToString()])["2"];
                    data.level = int.Parse((string)((LuaTable)respInfo[(i + 1).ToString()])["3"]);
                    data.power = int.Parse((string)((LuaTable)respInfo[(i + 1).ToString()])["4"]);

                    TongUIViewManager.PresenterData uidata = new TongUIViewManager.PresenterData();

                    uidata.level = data.level.ToString();
                    uidata.name  = data.name;
                    uidata.power = data.power.ToString();

                    m_listTongPresenterData.Add(data);
                    m_listTongPresenterUIData.Add(uidata);
                }

                TongUIViewManager.Instance.SetRecommendList(m_listTongPresenterUIData);
            }
            else
            {
                Debug.Log("获取推荐列表失败 " + errCode);
            }
            break;

        default:
            MogoGlobleUIManager.Instance.Info("回调消息id未定义 --!");
            break;
        }
    }