Beispiel #1
0
    void OnWndMapItemClick(UICustomGameSelectWnd.CMapInfo mapInfo, UICustomGameSelectWnd.CPlayerInfo playerInfo, UICustomMapItem item)
    {
        MapItemDescs desc = mMapItems[item.index];

        Pathea.CustomGameData customdata = null;
        try
        {
            customdata = Pathea.CustomGameData.Mgr.Instance.GetCustomData(desc.UID, desc.Path);
        }
        catch
        {
            mapInfo.texture.mainTexture = null;
            mapInfo.name.text           = "crap";
            mapInfo.size.text           = "crap";
        }
        finally
        {
            mapInfo.texture.mainTexture = customdata.screenshot;
            mapInfo.name.text           = customdata.name.ToString();
            mapInfo.size.text           = customdata.size.x.ToString() + "X" + customdata.size.z.ToString();

            //PlayerDesc[] human_descs = customdata.humanDescs;
            //playerInfo.playerList.items.Clear();
            //foreach (PlayerDesc pd in human_descs)
            //{
            //    playerInfo.playerList.items.Add(pd.Name);
            //}

            //playerInfo.playerList.selection = human_descs[0].Name;
        }
        hostCreatCtrl.UID = desc.UID;
    }
    void OnWndMapItemClick(UICustomGameSelectWnd.CMapInfo mapInfo, UICustomGameSelectWnd.CPlayerInfo playerInfo, UICustomMapItem item)
    {
        if (mMapItems.Count <= item.index)
        {
            return;
        }

        MapItemDescs desc = mMapItems[item.index];

        Pathea.CustomGameData customdata = null;
        try
        {
            customdata = Pathea.CustomGameData.Mgr.Instance.GetCustomData(desc.UID, desc.Path);
        }
        catch
        {
            mapInfo.texture.mainTexture = null;
            mapInfo.name.text           = "crap";
            mapInfo.size.text           = "crap";
        }
        finally
        {
            mapInfo.texture.mainTexture = customdata.screenshot;
            mapInfo.name.text           = customdata.name.ToString();
            mapInfo.size.text           = customdata.size.x.ToString() + "X" + customdata.size.z.ToString();

            PlayerDesc[] human_descs = customdata.humanDescs;

            if (human_descs.Length > 0 && playerInfo.playerList != null)
            {
                playerInfo.playerList.items.Clear();
                foreach (PlayerDesc pd in human_descs)
                {
                    playerInfo.playerList.items.Add(pd.Name);
                }

                playerInfo.playerList.selection = human_descs[0].Name;
            }
            else
            {
                playerInfo.playerList.items.Clear();
                playerInfo.playerList.selection = " ";
            }
        }
    }