コード例 #1
0
        public static void Prefix(Rect rect, List <ListableOption> optList)
        {
            //File.WriteAllText(Loger.PathLog + @"optList.txt", DevelopTest.TextObj(optList), Encoding.UTF8);
            if (optList.Count > 0 && optList[0].GetType() == typeof(ListableOption))
            {
                if (Current.ProgramState == ProgramState.Entry)
                {
                    var item = new ListableOption("OCity_LAN_btn".Translate(), delegate
                    {
                        MainMenu.OnMainMenuNetClick();
                    }, null);
                    optList.Insert(0, item);
                }
                else
                {
                    if (SessionClient.Get.IsLogined)
                    {
                        for (int i = 0; i < optList.Count; i++)
                        {
                            if (optList[i].label == "Save".Translate() ||
                                optList[i].label == "LoadGame".Translate() ||
                                optList[i].label == "ReviewScenario".Translate() ||
                                optList[i].label == "SaveAndQuitToMainMenu".Translate() ||
                                optList[i].label == "SaveAndQuitToOS".Translate() ||
                                optList[i].label == "ConfirmQuit".Translate() ||
                                optList[i].label == "QuitToMainMenu".Translate() ||
                                optList[i].label == "QuitToOS".Translate())
                            {
                                optList.RemoveAt(i--);
                            }
                        }
                        var item = new ListableOption("Онлайн".NeedTranslate(), delegate
                        {
                            Dialog_MainOnlineCity.ShowHide();
                        }, null);
                        optList.Add(item);

                        item = new ListableOption("QuitToMainMenu".Translate(), delegate
                        {
                            if (GameExit.BeforeExit != null)
                            {
                                GameExit.BeforeExit();
                            }
                            GenScene.GoToMainMenu();
                        }, null);
                        optList.Add(item);

                        item = new ListableOption("QuitToOS".Translate(), delegate
                        {
                            if (GameExit.BeforeExit != null)
                            {
                                GameExit.BeforeExit();
                            }
                            Root.Shutdown();
                        }, null);
                        optList.Add(item);
                    }
                }
            }

            if (Inited)
            {
                return;
            }
            Inited = true;
            SessionClientController.Init();
        }
コード例 #2
0
ファイル: StartPoint.cs プロジェクト: thomotron/OnlineCity
 public override void Activate()
 {
     Dialog_MainOnlineCity.ShowHide();
 }
コード例 #3
0
        public static void Prefix(Rect rect, List <ListableOption> optList)
        {
            if (optList.Count > 0 && optList[0].GetType() == typeof(ListableOption))
            {
                if (Current.ProgramState == ProgramState.Entry)
                {
                    var item = new ListableOption("OCity_LAN_btn".Translate(), delegate
                    {
                        MainMenu.OnMainMenuNetClick();
                    }, null);
                    optList.Insert(0, item);
                }
                else
                {
                    if (SessionClient.Get.IsLogined)
                    {
                        for (int i = 0; i < optList.Count; i++)
                        {
                            if (optList[i].label == "Save".Translate() ||
                                optList[i].label == "LoadGame".Translate() ||
                                optList[i].label == "ReviewScenario".Translate() ||
                                optList[i].label == "SaveAndQuitToMainMenu".Translate() ||
                                optList[i].label == "SaveAndQuitToOS".Translate() ||
                                optList[i].label == "ConfirmQuit".Translate() ||
                                optList[i].label == "QuitToMainMenu".Translate() ||
                                optList[i].label == "QuitToOS".Translate())
                            {
                                optList.RemoveAt(i--);
                            }
                        }
                        var item = new ListableOption("OCity_MainMenu_Online".Translate(), delegate
                        {
                            Dialog_MainOnlineCity.ShowHide();
                        }, null);
                        optList.Add(item);

                        if (SessionClientController.Data.AttackModule != null)
                        {
                            item = new ListableOption("OCity_MainMenu_Withdraw".Translate(), delegate
                            {
                                Loger.Log("Client MainMenu VictoryHost");
                                SessionClientController.Data.AttackModule.VictoryHostToHost = true;
                            }, null);
                            optList.Add(item);
                        }

                        if (SessionClientController.Data.AttackUsModule != null)
                        {
                            item = new ListableOption("OCity_MainMenu_Surrender".Translate(), delegate
                            {
                                Loger.Log("Client MainMenu VictoryAttacker");
                                SessionClientController.Data.AttackUsModule.ConfirmedVictoryAttacker = true;
                            }, null);
                            optList.Add(item);
                        }

                        item = new ListableOption("QuitToMainMenu".Translate(), delegate
                        {
                            if (GameExit.BeforeExit != null)
                            {
                                GameExit.BeforeExit();
                            }
                            GenScene.GoToMainMenu();
                        }, null);
                        optList.Add(item);

                        item = new ListableOption("QuitToOS".Translate(), delegate
                        {
                            if (GameExit.BeforeExit != null)
                            {
                                GameExit.BeforeExit();
                            }
                            Root.Shutdown();
                        }, null);
                        optList.Add(item);
                    }
                }
            }

            if (Inited)
            {
                return;
            }
            Inited = true;
            SessionClientController.Init();
        }