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);
    }
    void ConnectServer(bool needPasswold, ServerRegistered data)
    {
        if (null != data)
        {
            if (data.GameMode == (int)Pathea.PeGameMgr.ESceneMode.Custom)
            {
                if (string.IsNullOrEmpty(data.UID) || string.IsNullOrEmpty(data.MapName))
                {
                    return;
                }

                string filePath = Path.Combine(GameConfig.CustomDataDir, data.MapName);
                Pathea.CustomGameData.Mgr.Instance.curGameData = Pathea.CustomGameData.Mgr.Instance.GetCustomData(data.UID, filePath);
                if (null == Pathea.CustomGameData.Mgr.Instance.curGameData)
                {
                    return;
                }

                Pathea.PeGameMgr.mapUID = data.UID;
                ScenarioIntegrityCheck check = ScenarioMapUtils.CheckIntegrityByPath(filePath);
                StartCoroutine(ProcessIntegrityCheck(check, needPasswold, data));
            }
            else
            {
                Connect(needPasswold, data);
            }
        }
    }
    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);
        }
    }
        protected override void Load()
        {
            //            YirdData customData = CustomGameData.Mgr.Instance.GetYirdData(mGameName, yirdName);
            ////
            //            LoadCustom(newGame, customData);
            ScenarioMapDesc desc       = ScenarioMapUtils.GetMapByUID(mUID, GameConfig.CustomDataDir);
            CustomGameData  customData = CustomGameData.Mgr.Instance.GetCustomData(mUID, desc.Path);

            if (customData != null)
            {
                CustomGameData.Mgr.Instance.curGameData = customData;
                LoadCustom(newGame, customData);
            }
            else
            {
                Debug.LogError("Error");
            }
        }
Exemple #5
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);
    }