Esempio n. 1
0
    //进入公会地图
    public bool SC_GetActivityMapsInfo(Protomsg.MsgBase d1)
    {
        Debug.Log("SC_GetActivityMapsInfo:");
        IMessage IMperson = new Protomsg.SC_GetActivityMapsInfo();

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

        Protomsg.ActivityMapInfo[] allplayer = new Protomsg.ActivityMapInfo[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", "ActivityMapInfo").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("time").asTextField.text       = item.OpenStartTime + "--" + item.OpenEndTime;
            onedropitem.GetChild("week").asTextField.text       = "周" + item.OpenWeekDay;
            onedropitem.GetChild("pricetype").asLoader.url      = Tool.GetPriceTypeIcon(item.PriceType);
            onedropitem.GetChild("price").asTextField.text      = item.Price + "";
            //进入
            onedropitem.GetChild("goto").asButton.onClick.Add(() =>
            {
                Protomsg.CS_GotoActivityMap msg1 = new Protomsg.CS_GotoActivityMap();
                msg1.ID = item.ID;
                MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_GotoActivityMap", 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
    //夺宝奇兵 SC_GetDuoBaoInfo
    public bool SC_GetDuoBaoInfo(Protomsg.MsgBase d1)
    {
        Debug.Log("SC_GetDuoBaoInfo:");
        IMessage IMperson = new Protomsg.SC_GetDuoBaoInfo();

        Protomsg.SC_GetDuoBaoInfo p1 = (Protomsg.SC_GetDuoBaoInfo)IMperson.Descriptor.Parser.ParseFrom(d1.Datas);
        var item       = p1.MapGoInInfo;
        var clientitem = ExcelManager.Instance.GetSceneManager().GetSceneByID(item.NextSceneID);

        if (clientitem == null)
        {
            return(true);
        }
        var onedropitem = main.GetChild("duobaocom").asCom;

        onedropitem.GetChild("des").asTextField.SetVar("p1", p1.Minute + "");
        onedropitem.GetChild("des").asTextField.FlushVars();

        //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("time").asTextField.text       = item.OpenStartTime + "--" + item.OpenEndTime;
        onedropitem.GetChild("week").asTextField.text       = "周" + item.OpenWeekDay;
        onedropitem.GetChild("pricetype").asLoader.url      = Tool.GetPriceTypeIcon(item.PriceType);
        onedropitem.GetChild("price").asTextField.text      = item.Price + "";
        //进入
        onedropitem.GetChild("goto").asButton.onClick.Set(() =>
        {
            Protomsg.CS_GotoActivityMap msg1 = new Protomsg.CS_GotoActivityMap();
            msg1.ID = item.ID;
            MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_GotoActivityMap", msg1);
        });

        //地图信息
        //掉落道具
        onedropitem.GetChild("droplist").asList.RemoveChildren(0, -1, true);
        int[] allplayer = new int[p1.MapInfo.DropItems.Count];
        p1.MapInfo.DropItems.CopyTo(allplayer, 0);
        System.Array.Sort(allplayer, (a, b) => {
            if (a > b)
            {
                return(1);
            }
            else if (a < b)
            {
                return(-1);
            }
            return(0);
        });
        foreach (var itemdrop in allplayer)
        {
            var clientitemdrop = ExcelManager.Instance.GetItemManager().GetItemByID(itemdrop);
            if (clientitemdrop == null)
            {
                continue;
            }
            var onedropitemdrop = UIPackage.CreateObject("GameUI", "sellable").asCom;
            onedropitemdrop.GetChild("icon").asLoader.url = clientitemdrop.IconPath;
            onedropitemdrop.GetChild("icon").onClick.Add(() =>
            {
                new ItemInfo(itemdrop);
            });
            onedropitemdrop.GetChild("level").asTextField.text = "lv.1";
            onedropitem.GetChild("droplist").asList.AddChild(onedropitemdrop);
        }

        return(true);
    }