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);
            }
        }
    }
    IEnumerator ProcessIntegrityCheck(ScenarioIntegrityCheck check, bool needPasswold, ServerRegistered data)
    {
        while (true)
        {
            if (check.integrated == true)
            {
                Connect(needPasswold, data);
                break;
            }
            else if (check.integrated == false)
            {
                MessageBox_N.ShowOkBox(PELocalization.GetString(8000484));
                yield break;
            }

            yield return(null);
        }
    }
示例#4
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);
    }
    IEnumerator ProcessIntegrityCheck(ScenarioIntegrityCheck check)
    {
        mIsProcessCheck = true;

        while (true)
        {
            if (check.integrated == true)
            {
                try
                {
                    Pathea.PeGameMgr.loadArchive = Pathea.ArchiveMgr.ESave.New;
                    Pathea.PeGameMgr.sceneMode   = Pathea.PeGameMgr.ESceneMode.Custom;
                    Pathea.PeGameMgr.gameName    = selectWnd.selectedItem.nameStr;
                    Pathea.PeGameMgr.mapUID      = mMapItems[selectWnd.selectedItem.index].UID;
                }
                catch
                {
                    Debug.Log("This map is wrong, please chose anther one");
                    MessageBox_N.ShowOkBox(PELocalization.GetString(8000484));
                    selectWnd.HintBox.Close();
                    break;
                }

                selectWnd.HintBox.Msg          = "Correct";
                selectWnd.HintBox.isProcessing = false;
                yield return(new WaitForSeconds(0.5f));

                Pathea.PeFlowMgr.Instance.LoadScene(Pathea.PeFlowMgr.EPeScene.RoleScene);
                Debug.Log("Check Correct");

                break;
            }
            else if (check.integrated == false)
            {
                if (ignoreIntegrityCheck)
                {
                    try
                    {
                        Pathea.PeGameMgr.loadArchive = Pathea.ArchiveMgr.ESave.New;
                        Pathea.PeGameMgr.sceneMode   = Pathea.PeGameMgr.ESceneMode.Custom;
                        Pathea.PeGameMgr.gameName    = selectWnd.selectedItem.nameStr;
                        Pathea.PeGameMgr.mapUID      = mMapItems[selectWnd.selectedItem.index].UID;
                        Pathea.PeFlowMgr.Instance.LoadScene(Pathea.PeFlowMgr.EPeScene.RoleScene);
                    }
                    catch
                    {
                        Debug.Log("This map is wrong, please chose anther one");
                        MessageBox_N.ShowOkBox(PELocalization.GetString(8000484));
                        selectWnd.HintBox.Close();
                        break;
                    }
                }
                else
                {
                    Debug.Log("This map is wrong, please chose anther one");
                    MessageBox_N.ShowOkBox(PELocalization.GetString(8000484));
                    selectWnd.HintBox.Close();
                    break;
                }
            }

            yield return(0);
        }

        mIsProcessCheck = false;
    }