Esempio n. 1
0
    //获取公会地图信息
    public bool SC_GetGuildMapsInfo(Protomsg.MsgBase d1)
    {
        Debug.Log("CS_GetGuildMapsInfo:");
        IMessage IMperson = new Protomsg.SC_GetGuildMapsInfo();

        Protomsg.SC_GetGuildMapsInfo p1 = (Protomsg.SC_GetGuildMapsInfo)IMperson.Descriptor.Parser.ParseFrom(d1.Datas);
        if (main == null)
        {
            return(true);
        }
        main.GetChild("maplist").asList.RemoveChildren(0, -1, true);

        Protomsg.GuildMapInfo[] allplayer = new Protomsg.GuildMapInfo[p1.Maps.Count];
        p1.Maps.CopyTo(allplayer, 0);
        System.Array.Sort(allplayer, (a, b) => {
            if (a.ID > b.ID)
            {
                return(1);
            }
            else if (a.ID < b.ID)
            {
                return(-1);
            }
            return(0);
        });

        //遍历
        foreach (var item in allplayer)
        {
            var clientitem = ExcelManager.Instance.GetSceneManager().GetSceneByID(item.NextSceneID);
            if (clientitem == null)
            {
                continue;
            }

            var onedropitem = UIPackage.CreateObject("GameUI", "GuildMapInfo").asCom;


            //onedropitem.GetChild("item").asCom.GetChild("icon").asLoader.url = clientitem.IconPath;
            onedropitem.GetChild("name").asTextField.text       = clientitem.Name;
            onedropitem.GetChild("guildlevel").asTextField.text = item.NeedGuildLevel + "";
            onedropitem.GetChild("time").asTextField.text       = item.OpenStartTime + "--" + item.OpenEndTime;
            onedropitem.GetChild("week").asTextField.text       = "周" + item.OpenWeekDay;

            //进入
            onedropitem.GetChild("goto").asButton.onClick.Add(() =>
            {
                Protomsg.CS_GotoGuildMap msg1 = new Protomsg.CS_GotoGuildMap();
                msg1.ID = item.ID;
                MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_GotoGuildMap", msg1);
            });
            //地图信息
            onedropitem.GetChild("icon").asLoader.onClick.Add(() =>
            {
                Protomsg.CS_GetMapInfo msg1 = new Protomsg.CS_GetMapInfo();
                msg1.SceneID = item.NextSceneID;
                MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_GetMapInfo", msg1);
            });

            main.GetChild("maplist").asList.AddChild(onedropitem);
        }

        return(true);
    }
Esempio n. 2
0
    //获取副本信息
    public bool SC_GetCopyMapsInfo(Protomsg.MsgBase d1)
    {
        Debug.Log("SC_GetCopyMapsInfo:");
        IMessage IMperson = new Protomsg.SC_GetCopyMapsInfo();

        Protomsg.SC_GetCopyMapsInfo p1 = (Protomsg.SC_GetCopyMapsInfo)IMperson.Descriptor.Parser.ParseFrom(d1.Datas);
        main.GetChild("maplist").asList.RemoveChildren(0, -1, true);

        main.GetChild("playcount").asTextField.SetVar("p1", p1.RemainPlayTimes + "");
        main.GetChild("playcount").asTextField.FlushVars();

        Protomsg.CopyMapInfo[] allplayer = new Protomsg.CopyMapInfo[p1.Maps.Count];
        p1.Maps.CopyTo(allplayer, 0);
        System.Array.Sort(allplayer, (a, b) => {
            if (a.NeedLevel > b.NeedLevel)
            {
                return(-1);
            }
            return(1);
        });

        //遍历
        foreach (var item in allplayer)
        {
            var clientitem = ExcelManager.Instance.GetSceneManager().GetSceneByID(item.NextSceneID);
            if (clientitem == null)
            {
                continue;
            }

            var onedropitem = UIPackage.CreateObject("GameUI", "CopyMapInfo").asCom;

            //onedropitem.GetChild("item").asCom.GetChild("icon").asLoader.url = clientitem.IconPath;
            onedropitem.GetChild("name").asTextField.text        = clientitem.Name;
            onedropitem.GetChild("guildlevel").asTextField.text  = item.NeedLevel + "";
            onedropitem.GetChild("playercount").asTextField.text = item.PlayerCount + "";

            //进入
            onedropitem.GetChild("pipei").asButton.onClick.Add(() =>
            {
                Protomsg.CS_CopyMapPiPei msg1 = new Protomsg.CS_CopyMapPiPei();
                msg1.CopyMapID = item.ID;
                MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_CopyMapPiPei", msg1);
            });

            //地图信息
            onedropitem.GetChild("cancel").asButton.onClick.Add(() =>
            {
                Protomsg.CS_CopyMapCancel msg1 = new Protomsg.CS_CopyMapCancel();
                MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_CopyMapCancel", msg1);
            });
            //地图信息
            onedropitem.GetChild("icon").asLoader.onClick.Add(() =>
            {
                Protomsg.CS_GetMapInfo msg1 = new Protomsg.CS_GetMapInfo();
                msg1.SceneID = item.NextSceneID;
                MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_GetMapInfo", msg1);
            });

            if (item.State == 1)//可以匹配
            {
                Controller ct = onedropitem.GetController("c1");
                ct.SetSelectedIndex(0);
            }
            else if (item.State == 2)//匹配中
            {
                Controller ct = onedropitem.GetController("c1");
                ct.SetSelectedIndex(1);
            }


            main.GetChild("maplist").asList.AddChild(onedropitem);
        }

        return(true);
    }