bool OnWndStartClick()
    {
        if (mIsProcessCheck)
        {
            return(true);
        }

        if (selectWnd.selectedItem != null && !selectWnd.selectedItem.IsFile)
        {
            MapItemDescs          desc       = mMapItems[selectWnd.selectedItem.index];
            Pathea.CustomGameData customdata = Pathea.CustomGameData.Mgr.Instance.GetCustomData(desc.UID, desc.Path);
            if (customdata == null || customdata.humanDescs.Length == 0)
            {
                //lz-2016.10.31 Need a player to start
                MessageBox_N.ShowOkBox(PELocalization.GetString(8000859));
                return(true);
            }

            MapItemDescs           mid   = mMapItems[selectWnd.selectedItem.index];
            ScenarioIntegrityCheck check = ScenarioMapUtils.CheckIntegrityByPath(mid.Path);
            StartCoroutine(ProcessIntegrityCheck(check));
            selectWnd.HintBox.Msg          = "Checking";
            selectWnd.HintBox.isProcessing = true;
            selectWnd.HintBox.Open();
        }

        return(true);
    }
Exemplo n.º 2
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;
    }
Exemplo n.º 3
0
    void OnWndPlayerSelectChanged(int playerIndex)
    {
        MapItemDescs desc = mMapItems[selectWnd.selectedItem.index];

        Pathea.CustomGameData customdata = Pathea.CustomGameData.Mgr.Instance.GetCustomData(desc.UID, desc.Path);
        if (customdata.DeterminePlayer(playerIndex))
        {
#if UNITY_EDITOR
            Debug.Log("Select the player [" + customdata.curPlayer.Name + "]");
#endif
        }
    }
    void GetMapItemDescs(List <MapItemDescs> mapItemDesces, string dir)
    {
        DirectoryInfo dirInfo = new DirectoryInfo(dir);

        if (!dirInfo.Exists)
        {
            Debug.LogWarning("The dir[" + GameConfig.CustomDataDir + "] is not exsit");
            return;
        }

        DirectoryInfo[] subDirInfos = dirInfo.GetDirectories();

        if (subDirInfos == null || subDirInfos.Length == 0)
        {
            return;
        }


        mMapDescs.Clear();
        ScenarioMapDesc[] map_descs = ScenarioMapUtils.GetMapList(dir);
        for (int i = 0; i < map_descs.Length; i++)
        {
            mMapDescs.Add(map_descs[i].Name, map_descs[i]);
        }

        foreach (DirectoryInfo info in subDirInfos)
        {
            MapItemDescs midcs = new MapItemDescs();
            if (mMapDescs.ContainsKey(info.Name))
            {
                ScenarioMapDesc desc = mMapDescs[info.Name];
                midcs.IsDir = false;
                midcs.Name  = desc.Name;
                midcs.Path  = desc.Path;
                midcs.UID   = desc.UID;
            }
            else
            {
                midcs.IsDir = true;
                midcs.Name  = info.Name;
                midcs.Path  = info.FullName;
                midcs.UID   = null;
            }

            mapItemDesces.Add(midcs);
        }
    }
    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 = " ";
            }
        }
    }
Exemplo n.º 6
0
    public bool OnWndStartClick()
    {
        if (mIsProcessCheck)
        {
            return(true);
        }

        if (selectWnd.selectedItem != null && !selectWnd.selectedItem.IsFile)
        {
            mIntegrity = null;
            MapItemDescs           mid   = mMapItems[selectWnd.selectedItem.index];
            ScenarioIntegrityCheck check = ScenarioMapUtils.CheckIntegrityByPath(mid.Path);
            StartCoroutine(ProcessIntegrityCheck(check));
            selectWnd.HintBox.Msg          = "Checking";
            selectWnd.HintBox.isProcessing = true;
            selectWnd.HintBox.Open();
            mMask.enabled = true;
        }

        return(true);
    }