コード例 #1
0
 public void SetConfirmationDialog(IConfirmationDialog iConfirmationDialog, GameDelegates.VoidFunction yesFunction, GameDelegates.VoidFunction noFunction)
 {
     this.personTextDialog.iConfirmationDialog   = iConfirmationDialog;
     this.personTextDialog.YesFunction           = yesFunction;
     this.personTextDialog.NoFunction            = noFunction;
     this.personTextDialog.HasConfirmationDialog = true;
 }
コード例 #2
0
        public DateRunner()
        {
            btChangeDays                = new ButtonTexture(@"Content\Textures\Resources\Start\Setting", "Setting", null);
            btChangeDays.Scale          = 0.8f;
            btChangeDays.OnButtonPress += (sender, e) =>
            {
                GameDelegates.VoidFunction function = null;

                Session.MainGame.mainGameScreen.Plugins.NumberInputerPlugin.SetMax(MAX_DAY);
                Session.MainGame.mainGameScreen.Plugins.NumberInputerPlugin.SetMapPosition(ShowPosition.Center);
                Session.MainGame.mainGameScreen.Plugins.NumberInputerPlugin.SetDepthOffset(-0.01f);
                if (function == null)
                {
                    function = delegate
                    {
                        var number = Session.MainGame.mainGameScreen.Plugins.NumberInputerPlugin.Number;
                        if (number < 1)
                        {
                            number = 1;
                        }
                        DaysToGo     = number;
                        this.Updated = false;
                    };
                }
                Session.MainGame.mainGameScreen.Plugins.NumberInputerPlugin.SetEnterFunction(function);
                Session.MainGame.mainGameScreen.Plugins.NumberInputerPlugin.IsShowing = true;
            };
        }
コード例 #3
0
ファイル: MGSStartLoad.cs プロジェクト: parhelia512/ZHSan
        public override void LoadGame()   //从游戏里读取存档
        {
            this.Plugins.OptionDialogPlugin.SetStyle("SaveAndLoad");
            this.Plugins.OptionDialogPlugin.SetTitle("读取进度");
            this.Plugins.OptionDialogPlugin.Clear();

            var saves = GameScenario.LoadScenarioSaves();

            for (int i = 0; i <= GameScenario.savemaxcounts; i++)
            {
                string ss = i < 10 ? "0" + i.ToString() : i.ToString();
                GameDelegates.VoidFunction voidFunction = delegate
                {
                    var sce = saves[int.Parse(ss)];

                    if (!String.IsNullOrEmpty(sce.Title))
                    {
                        mainMapLayer.StopThreads();
                        Session.StartScenario(sce, true);
                    }
                };
                saves[i].ID = ss;
                this.Plugins.OptionDialogPlugin.AddOption(saves[i].Summary, null, voidFunction);
            }

            this.Plugins.OptionDialogPlugin.EndAddOptions();
            this.Plugins.OptionDialogPlugin.ShowOptionDialog(ShowPosition.Center);
        }
コード例 #4
0
 public void SetConfirmationDialog(IConfirmationDialog iConfirmationDialog, GameDelegates.VoidFunction yesFunction, GameDelegates.VoidFunction noFunction)
 {
     this.tupianwenzi.iConfirmationDialog   = iConfirmationDialog;
     this.tupianwenzi.YesFunction           = yesFunction;
     this.tupianwenzi.NoFunction            = noFunction;
     this.tupianwenzi.HasConfirmationDialog = true;
 }
コード例 #5
0
 private void screen_OnMouseLeftDown(Point position)
 {
     if (StaticMethods.PointInRectangle(position, this.YesDisplayPosition))
     {
         this.Result = DialogResult.Yes;
         this.screen.PlayNormalSound(this.YesSoundFile);
         if (this.YesFunction != null)
         {
             this.YesFunction();
             this.YesFunction = null;
         }
         this.IsShowing = false;
     }
     else if (StaticMethods.PointInRectangle(position, this.NoDisplayPosition))
     {
         this.Result = DialogResult.No;
         this.screen.PlayNormalSound(this.NoSoundFile);
         if (this.NoFunction != null)
         {
             this.NoFunction();
             this.NoFunction = null;
         }
         this.IsShowing = false;
     }
 }
コード例 #6
0
 private void screen_OnMouseLeftDown(Point position)
 {
     if (StaticMethods.PointInRectangle(position, this.YesDisplayPosition))
     {
         this.Result = DialogResult.Yes;
         this.screen.PlayNormalSound(this.YesSoundFile);
         if (this.YesFunction != null)
         {
             this.YesFunction();
             this.YesFunction = null;
         }
         this.IsShowing = false;
     }
     else if (StaticMethods.PointInRectangle(position, this.NoDisplayPosition))
     {
         this.Result = DialogResult.No;
         this.screen.PlayNormalSound(this.NoSoundFile);
         if (this.NoFunction != null)
         {
             this.NoFunction();
             this.NoFunction = null;
         }
         this.IsShowing = false;
     }
 }
コード例 #7
0
 internal void AddOptionItem(string Text, object obj, GameDelegates.VoidFunction optionFunction)
 {
     this.OptionTextList.AddText(Text);
     this.OptionObjects.Add(obj);
     this.OptionTextures.Add(this.OptionTexture);
     this.OptionFunctions.Add(optionFunction);
 }
コード例 #8
0
ファイル: MGSshubiao.cs プロジェクト: lemingcen/ZHSan
        private void HandleLaterMouseRightDown()
        {
            if (this.editMode)
            {
                if ((InputManager.MouseStatePre.RightButton == ButtonState.Released) && (InputManager.NowMouse.RightButton == ButtonState.Pressed))
                {
                    int x = (InputManager.NowMouse.X - this.mainMapLayer.LeftEdge) / Session.Current.Scenario.ScenarioMap.TileWidth;
                    int y = (InputManager.NowMouse.Y - this.mainMapLayer.TopEdge) / Session.Current.Scenario.ScenarioMap.TileHeight;
                    Session.Current.Scenario.ScenarioMap.MapData[x, y] = 0;
                    this.mainMapLayer.chongsheditukuaitupian(x, y);
                }
            }
            else
            {

                GameDelegates.VoidFunction optionFunction = null;
                if ((InputManager.MouseStatePre.RightButton == ButtonState.Released) && (InputManager.NowMouse.RightButton == ButtonState.Pressed))
                {
                    if ((this.Plugins.OptionDialogPlugin != null) && (Session.GlobalVariables.CurrentMapLayer == MapLayerKind.Routeway))
                    {
                        List<Routeway> routewaysByPositionAndFaction = Session.Current.Scenario.GetRoutewaysByPositionAndFaction(this.position, Session.Current.Scenario.CurrentPlayer);
                        List<Routeway> list2 = new List<Routeway>();
                        foreach (Routeway routeway in routewaysByPositionAndFaction)
                        {
                            if ((routeway.StartArchitecture == null) || ((((routeway.DestinationArchitecture != null) && routeway.StartArchitecture.BelongedSection.AIDetail.AutoRun) && !routeway.Building) && (routeway.LastActivePointIndex < 0)))
                            {
                                list2.Add(routeway);
                            }
                        }
                        foreach (Routeway routeway in list2)
                        {
                            routewaysByPositionAndFaction.Remove(routeway);
                        }
                        if ((routewaysByPositionAndFaction.Count > 1) && !Session.Current.Scenario.PositionIsTroop(this.position))
                        {
                            this.Plugins.OptionDialogPlugin.SetStyle("Small");
                            this.Plugins.OptionDialogPlugin.SetTitle("粮道");
                            this.Plugins.OptionDialogPlugin.Clear();
                            this.Plugins.OptionDialogPlugin.SetReturnObjectFunction(new GameDelegates.ObjectFunction(this.RoutewayOptionDialogClickCallback));
                            foreach (Routeway routeway in routewaysByPositionAndFaction)
                            {
                                if (optionFunction == null)
                                {
                                    optionFunction = delegate
                                    {
                                        this.ContextMenuRightClick();
                                    };
                                }
                                this.Plugins.OptionDialogPlugin.AddOption(routeway.DisplayName, routeway, optionFunction);
                            }
                            this.Plugins.OptionDialogPlugin.EndAddOptions();
                            this.Plugins.OptionDialogPlugin.ShowOptionDialog(ShowPosition.Mouse);
                            return;
                        }
                    }
                    this.ContextMenuRightClick();
                }
            }
        }
コード例 #9
0
 private void Enter()
 {
     if (this.EnterFunction != null)
     {
         this.EnterFunction();
         this.EnterFunction = null;
     }
     this.IsShowing = false;
 }
コード例 #10
0
 internal GameObjectAndBranchName(GameObject p, List <SimpleText> list, string name, IConfirmationDialog confirmationDialog, GameDelegates.VoidFunction yesFunction, GameDelegates.VoidFunction noFunction)
 {
     this.person = p as Person;
     this.texts.AddRange(list);
     this.branchName          = name;
     this.iConfirmationDialog = confirmationDialog;
     this.YesFunction         = yesFunction;
     this.NoFunction          = noFunction;
 }
コード例 #11
0
 internal GameObjectAndBranchName(Person p, GameObject g, List<SimpleText> list, string name, IConfirmationDialog confirmationDialog, GameDelegates.VoidFunction yesFunction, GameDelegates.VoidFunction noFunction)
 {
     this.person = p;
     this.gameObject = g;
     this.texts.AddRange(list);
     this.branchName = name;
     this.iConfirmationDialog = confirmationDialog;
     this.YesFunction = yesFunction;
     this.NoFunction = noFunction;
 }
コード例 #12
0
 private void screen_OnMouseRightDown(Point position)
 {
     this.Result = DialogResult.No;
     this.screen.PlayNormalSound(this.NoSoundFile);
     if (this.NoFunction != null)
     {
         this.NoFunction();
         this.NoFunction = null;
     }
     this.IsShowing = false;
 }
コード例 #13
0
ファイル: MapViewSelector.cs プロジェクト: zhaohuwei/ZHSan
        private void screen_OnMouseLeftUp(Point position)
        {
            if (!StaticMethods.PointInRectangle(position, this.TitleDisplayPosition))
            {
                if (this.ReturnToListButtonSelected)
                {
                    this.IsShowing = false;
                }
                else if (this.OKButtonSelected)
                {
                    this.IsShowing = false;
                    if (this.OKFunction != null)
                    {
                        this.OKFunction();
                        this.OKFunction = null;
                    }
                    this.iGameFrame.OK();
                }
                else if (this.CancelButtonSelected)
                {
                    this.IsShowing = false;
                    this.iGameFrame.Cancel();
                }
                else
                {
                    Point positionByPoint = Session.MainGame.mainGameScreen.GetPositionByPoint(position);
                    if (Session.MainGame.mainGameScreen.TileInScreen(positionByPoint) && (this.Kind == MapViewSelectorKind.建筑))
                    {
                        Architecture architectureByPosition = Session.Current.Scenario.GetArchitectureByPosition(positionByPoint);
                        if ((architectureByPosition != null) && this.SelectingGameObjectList.HasGameObject(architectureByPosition.ID))
                        {
                            architectureByPosition.Selected = !architectureByPosition.Selected;
                            if (!this.MultiSelecting && architectureByPosition.Selected)
                            {
                                this.SelectingGameObjectList.SetOtherUnSelected(architectureByPosition);
                                if (Setting.Current.GlobalVariables.SingleSelectionOneClick)
                                {
                                    this.iTabList.RefreshEditable();
                                    this.IsShowing = false;
                                    this.iGameFrame.OK();
                                    return;
                                }
                            }
                            this.iTabList.RefreshEditable();
                        }
                    }
                }
            }

            ///////////////////////////////////////////////////////////////////
            this.dragging = false;
        }
コード例 #14
0
        private bool DequeueAndDisplay(Screen screen)
        {
            if (this.DisplayQueue.Count > 0)
            {
                this.startShowingTime = DateTime.Now;
                GameObjectAndBranchName name = this.DisplayQueue.Dequeue();
                this.shijiantupian       = this.shijiantupianduilie.Dequeue();
                this.shijiantupianjuxing = this.juxingduilie.Dequeue();
                this.SetPosition(ShowPosition.Bottom, screen);
                this.shijianshengyin = this.shijianshengyinduilie.Dequeue();
                this.SpeakingPerson  = name.person;
                this.NameText.Text   = name.person.Name;
                if (name.TryToShowString != null && name.TryToShowString.Length > 1)
                {
                    this.TryToShowString = name.TryToShowString;
                }
                else
                {
                    this.TryToShowString = "";
                }
                if (TryToShowString != null && TryToShowString.Length > 1)
                {
                    this.SetPosition(ShowPosition.BottomLeft, screen);
                }
                this.RichText.Clear();
                if (this.diyigeshengyin)
                {
                    screen.PlayNormalSound(this.shijianshengyin);
                    this.diyigeshengyin = false;
                }

                this.RichText.Texts = name.texts;
                this.RichText.ResortTexts();
                if (name.iConfirmationDialog != null)
                {
                    this.iConfirmationDialog = name.iConfirmationDialog;
                    this.iConfirmationDialog.SetPersonTextDialog(this.iPersonTextDialog);
                    this.iConfirmationDialog.AddYesFunction(name.YesFunction);
                    this.iConfirmationDialog.AddNoFunction(name.NoFunction);
                    this.iConfirmationDialog.IsShowing = true;
                }
                else
                {
                    this.iConfirmationDialog = null;
                    this.YesFunction         = null;
                    this.NoFunction          = null;
                }
                return(false);
            }
            return(true);
        }
コード例 #15
0
 private void HandleLaterMouseRightDown()
 {
     GameDelegates.VoidFunction optionFunction = null;
     if ((this.previousMouseState.RightButton == ButtonState.Released) && (this.mouseState.RightButton == ButtonState.Pressed))
     {
         if ((this.Plugins.OptionDialogPlugin != null) && (GlobalVariables.CurrentMapLayer == MapLayerKind.Routeway))
         {
             List <Routeway> routewaysByPositionAndFaction = base.Scenario.GetRoutewaysByPositionAndFaction(this.position, base.Scenario.CurrentPlayer);
             List <Routeway> list2 = new List <Routeway>();
             foreach (Routeway routeway in routewaysByPositionAndFaction)
             {
                 if ((routeway.StartArchitecture == null) || ((((routeway.DestinationArchitecture != null) && routeway.StartArchitecture.BelongedSection.AIDetail.AutoRun) && !routeway.Building) && (routeway.LastActivePointIndex < 0)))
                 {
                     list2.Add(routeway);
                 }
             }
             foreach (Routeway routeway in list2)
             {
                 routewaysByPositionAndFaction.Remove(routeway);
             }
             if ((routewaysByPositionAndFaction.Count > 1) && !base.Scenario.PositionIsTroop(this.position))
             {
                 this.Plugins.OptionDialogPlugin.SetStyle("Small");
                 this.Plugins.OptionDialogPlugin.SetTitle("粮道");
                 this.Plugins.OptionDialogPlugin.Clear();
                 this.Plugins.OptionDialogPlugin.SetReturnObjectFunction(new GameDelegates.ObjectFunction(this.RoutewayOptionDialogClickCallback));
                 foreach (Routeway routeway in routewaysByPositionAndFaction)
                 {
                     if (optionFunction == null)
                     {
                         optionFunction = delegate
                         {
                             this.ContextMenuRightClick();
                         };
                     }
                     this.Plugins.OptionDialogPlugin.AddOption(routeway.DisplayName, routeway, optionFunction);
                 }
                 this.Plugins.OptionDialogPlugin.EndAddOptions();
                 this.Plugins.OptionDialogPlugin.ShowOptionDialog(ShowPosition.Mouse);
                 return;
             }
         }
         this.ContextMenuRightClick();
     }
 }
コード例 #16
0
 internal void SetGameObjectBranch(GameObject gongfang, GameObject gameObject, string branchName)
 {
     this.BuildingRichText.Clear();
     if (gameObject != null)
     {
         this.BuildingRichText.AddGameObjectTextBranch(gongfang, this.TextTree.GetBranch(branchName));
     }
     if (this.HasConfirmationDialog)
     {
         this.DisplayQueue.Enqueue(new GameObjectAndBranchName(gongfang, gameObject, this.BuildingRichText.Texts, branchName, this.iConfirmationDialog, this.YesFunction, this.NoFunction));
         this.YesFunction = null;
         this.NoFunction  = null;
     }
     else
     {
         this.DisplayQueue.Enqueue(new GameObjectAndBranchName(gongfang, gameObject, this.BuildingRichText.Texts, branchName, null, null, null));
     }
     this.HasConfirmationDialog = false;
 }
コード例 #17
0
 public override void InitializeMapViewSelectorButton()
 {
     GameDelegates.VoidFunction function = null;
     if (this.MapViewSelectorButtonEnabled)
     {
         if (function == null)
         {
             function = delegate {
                 this.iMapViewSelector.SetMultiSelecting(this.MultiSelecting);
                 this.iMapViewSelector.SetGameObjectList(this.gameObjectList);
                 if (this.firstTimeMapViewSelector)
                 {
                     this.firstTimeMapViewSelector = false;
                     this.iMapViewSelector.SetMapPosition(ShowPosition.Center);
                 }
                 this.iMapViewSelector.IsShowing = true;
             };
         }
         base.MapViewSelectorFunction = function;
     }
 }
コード例 #18
0
 private bool DequeueAndDisplay()
 {
     if (this.DisplayQueue.Count > 0)
     {
         this.startShowingTime = DateTime.Now;
         GameObjectAndBranchName name = this.DisplayQueue.Dequeue();
         this.SpeakingPerson = name.person;
         this.NameText.Text  = name.person.Name;
         this.RichText.Clear();
         if (name.gameObject == null)
         {
             this.RichText.AddText(name.branchName);
         }
         else
         {
             this.RichText.Texts = name.texts;
         }
         this.RichText.ResortTexts();
         if (name.iConfirmationDialog != null)
         {/*
           * this.iConfirmationDialog = name.iConfirmationDialog;
           * this.iConfirmationDialog.SetPersonTextDialog(this.iPersonTextDialog);
           * this.iConfirmationDialog.AddYesFunction(name.YesFunction);
           * this.iConfirmationDialog.AddNoFunction(name.NoFunction);
           * this.iConfirmationDialog.IsShowing = true;
           */
         }
         else
         {
             this.iConfirmationDialog = null;
             this.YesFunction         = null;
             this.NoFunction          = null;
         }
         return(false);
     }
     return(true);
 }
コード例 #19
0
 public void SetOKFunction(GameDelegates.VoidFunction function)
 {
     this.mapViewSelector.OKFunction = function;
 }
コード例 #20
0
ファイル: OptionDialogPlugin.cs プロジェクト: zhaohuwei/ZHSan
 public void AddOption(string Text, object obj, GameDelegates.VoidFunction optionFunciton)
 {
     this.optionDialog.AddOptionItem(Text, obj, optionFunciton);
 }
コード例 #21
0
        private void ShowOrientationFrame()
        {
            GameDelegates.VoidFunction function  = null;
            GameDelegates.VoidFunction function2 = null;
            GameDelegates.VoidFunction function3 = null;
            switch (this.EditingSection.AIDetail.OrientationKind)
            {
            case SectionOrientationKind.军区:
                this.TabListPlugin.InitialValues(this.EditingFaction.GetOtherSections(this.OriginalSection), null, this.screen.MouseState.ScrollWheelValue, "");
                this.TabListPlugin.SetListKindByName("Section", true, false);
                this.TabListPlugin.SetSelectedTab("");
                this.GameFramePlugin.Kind     = FrameKind.TerrainDetail;
                this.GameFramePlugin.Function = FrameFunction.Transport;
                this.GameFramePlugin.SetFrameContent(this.TabListPlugin.TabList, this.screen.viewportSize);
                this.GameFramePlugin.OKButtonEnabled     = false;
                this.GameFramePlugin.CancelButtonEnabled = true;
                if (function == null)
                {
                    function = delegate {
                        this.EditingSection.OrientationFaction      = null;
                        this.EditingSection.OrientationState        = null;
                        this.EditingSection.OrientationArchitecture = null;
                        this.EditingSection.OrientationSection      = this.TabListPlugin.SelectedItem as Section;
                        this.RefreshOKButton();
                        this.RefreshLabelTextsDisplay();
                    };
                }
                this.GameFramePlugin.SetOKFunction(function);
                break;

            case SectionOrientationKind.势力:
                this.TabListPlugin.InitialValues(this.EditingFaction.Scenario.DiplomaticRelations.GetDiplomaticRelationDisplayListByFactionID(this.EditingFaction.ID).GetList(), null, this.screen.MouseState.ScrollWheelValue, "");
                this.TabListPlugin.SetListKindByName("DiplomaticRelation", true, false);
                this.TabListPlugin.SetSelectedTab("");
                this.GameFramePlugin.Kind     = FrameKind.CastTargetKind;
                this.GameFramePlugin.Function = FrameFunction.GetSectionToDemolish;
                this.GameFramePlugin.SetFrameContent(this.TabListPlugin.TabList, this.screen.viewportSize);
                this.GameFramePlugin.OKButtonEnabled     = false;
                this.GameFramePlugin.CancelButtonEnabled = true;
                if (function2 == null)
                {
                    function2 = delegate {
                        this.EditingSection.OrientationSection      = null;
                        this.EditingSection.OrientationState        = null;
                        this.EditingSection.OrientationArchitecture = null;
                        DiplomaticRelationDisplay selectedItem = this.TabListPlugin.SelectedItem as DiplomaticRelationDisplay;
                        if (selectedItem.LinkedFaction1 == this.EditingFaction)
                        {
                            this.EditingSection.OrientationFaction = selectedItem.LinkedFaction2;
                        }
                        else if (selectedItem.LinkedFaction2 == this.EditingFaction)
                        {
                            this.EditingSection.OrientationFaction = selectedItem.LinkedFaction1;
                        }
                        this.RefreshOKButton();
                        this.RefreshLabelTextsDisplay();
                    };
                }
                this.GameFramePlugin.SetOKFunction(function2);
                break;

            case SectionOrientationKind.州域:
                this.TabListPlugin.InitialValues(this.EditingFaction.Scenario.States.GetList(), null, this.screen.MouseState.ScrollWheelValue, "");
                this.TabListPlugin.SetListKindByName("State", true, false);
                this.TabListPlugin.SetSelectedTab("");
                this.GameFramePlugin.Kind     = FrameKind.SectionAIDetail;
                this.GameFramePlugin.Function = FrameFunction.GetFaction;
                this.GameFramePlugin.SetFrameContent(this.TabListPlugin.TabList, this.screen.viewportSize);
                this.GameFramePlugin.OKButtonEnabled     = false;
                this.GameFramePlugin.CancelButtonEnabled = true;
                if (function3 == null)
                {
                    function3 = delegate {
                        this.EditingSection.OrientationFaction      = null;
                        this.EditingSection.OrientationSection      = null;
                        this.EditingSection.OrientationState        = this.TabListPlugin.SelectedItem as State;
                        this.EditingSection.OrientationArchitecture = null;
                        this.RefreshOKButton();
                        this.RefreshLabelTextsDisplay();
                    };
                }
                this.GameFramePlugin.SetOKFunction(function3);
                break;

            case SectionOrientationKind.建筑:
                ArchitectureList allArch    = this.EditingFaction.Scenario.Architectures;
                ArchitectureList targetArch = new ArchitectureList();
                foreach (Architecture a in allArch)
                {
                    if (a.BelongedFaction != this.EditingFaction)
                    {
                        targetArch.Add(a);
                    }
                }
                this.TabListPlugin.InitialValues(targetArch, null, this.screen.MouseState.ScrollWheelValue, "");
                this.TabListPlugin.SetListKindByName("Architecture", true, false);
                this.TabListPlugin.SetSelectedTab("");
                this.GameFramePlugin.Kind     = FrameKind.Architecture;
                this.GameFramePlugin.Function = FrameFunction.GetFaction;
                this.GameFramePlugin.SetFrameContent(this.TabListPlugin.TabList, this.screen.viewportSize);
                this.GameFramePlugin.OKButtonEnabled     = false;
                this.GameFramePlugin.CancelButtonEnabled = true;
                if (function3 == null)
                {
                    function3 = delegate
                    {
                        this.EditingSection.OrientationFaction      = null;
                        this.EditingSection.OrientationSection      = null;
                        this.EditingSection.OrientationState        = null;
                        this.EditingSection.OrientationArchitecture = this.TabListPlugin.SelectedItem as Architecture;
                        this.RefreshOKButton();
                        this.RefreshLabelTextsDisplay();
                    };
                }
                this.GameFramePlugin.SetOKFunction(function3);
                break;
            }
            this.GameFramePlugin.IsShowing = true;
        }
コード例 #22
0
ファイル: GameFramePlugin.cs プロジェクト: zhaohuwei/ZHSan
 public void SetOKFunction(GameDelegates.VoidFunction function)
 {
     this.gameFrame.SetOKFunction(function);
 }
コード例 #23
0
        private void screen_OnMouseLeftUp(Point position)
        {
            if (!StaticMethods.PointInRectangle(position, this.TitleDisplayPosition))
            {
                if (this.ReturnToListButtonSelected)
                {
                    this.IsShowing = false;
                }
                else if (this.OKButtonSelected)
                {
                    this.IsShowing = false;
                    if (this.OKFunction != null)
                    {
                        this.OKFunction();
                        this.OKFunction = null;
                    }
                    this.iGameFrame.OK();

                }
                else if (this.CancelButtonSelected)
                {
                    this.IsShowing = false;
                    this.iGameFrame.Cancel();
                }
                else
                {
                    Point positionByPoint = this.screen.GetPositionByPoint(position);
                    if (this.screen.TileInScreen(positionByPoint) && (this.Kind == MapViewSelectorKind.建筑))
                    {
                        Architecture architectureByPosition = this.screen.Scenario.GetArchitectureByPosition(positionByPoint);
                        if ((architectureByPosition != null) && this.SelectingGameObjectList.HasGameObject(architectureByPosition.ID))
                        {
                            architectureByPosition.Selected = !architectureByPosition.Selected;
                            if (!this.MultiSelecting && architectureByPosition.Selected)
                            {
                                this.SelectingGameObjectList.SetOtherUnSelected(architectureByPosition);
                                if (GlobalVariables.SingleSelectionOneClick)
                                {
                                    this.iTabList.RefreshEditable();
                                    this.IsShowing = false;
                                    this.iGameFrame.OK();
                                    return;
                                }
                            }
                            this.iTabList.RefreshEditable();
                        }
                    }
                }
            }

            ///////////////////////////////////////////////////////////////////
            this.dragging = false;
        }
コード例 #24
0
 public void AddNoFunction(GameDelegates.VoidFunction noFunction)
 {
     this.confirmationDialog.NoFunction = noFunction;
 }
コード例 #25
0
 private void Enter()
 {
     if (this.EnterFunction != null)
     {
         this.EnterFunction();
         this.EnterFunction = null;
     }
     this.IsShowing = false;
 }
コード例 #26
0
ファイル: GameFrame.cs プロジェクト: lemingcen/ZHSan
 internal void SetCancelFunction(GameDelegates.VoidFunction cancelfunction)
 {
     this.frameContent.CancelFunction = cancelfunction;
 }
コード例 #27
0
 public void SetCloseFunction(GameDelegates.VoidFunction closeFunction)
 {
     this.tupianwenzi.CloseFunction += closeFunction;
 }
コード例 #28
0
        private void ShowOrientationFrame()
        {
            if (this.EditingFaction == null || this.EditingSection.AIDetail == null || this.TabListPlugin == null || this.GameFramePlugin == null)
            {
                return;
            }

            try
            {
                GameDelegates.VoidFunction function  = null;
                GameDelegates.VoidFunction function2 = null;
                GameDelegates.VoidFunction function3 = null;
                switch (this.EditingSection.AIDetail.OrientationKind)
                {
                case SectionOrientationKind.军区:
                    this.TabListPlugin.InitialValues(this.EditingFaction.GetOtherSections(this.OriginalSection), null, InputManager.NowMouse.ScrollWheelValue, "");
                    this.TabListPlugin.SetListKindByName("Section", true, false);
                    this.TabListPlugin.SetSelectedTab("");
                    this.GameFramePlugin.Kind     = FrameKind.TerrainDetail;
                    this.GameFramePlugin.Function = FrameFunction.Transport;
                    this.GameFramePlugin.SetFrameContent(this.TabListPlugin.TabList, Session.MainGame.mainGameScreen.viewportSizeFull);
                    this.GameFramePlugin.OKButtonEnabled     = false;
                    this.GameFramePlugin.CancelButtonEnabled = true;
                    if (function == null)
                    {
                        function = delegate
                        {
                            this.EditingSection.OrientationFaction      = null;
                            this.EditingSection.OrientationState        = null;
                            this.EditingSection.OrientationArchitecture = null;
                            this.EditingSection.OrientationSection      = this.TabListPlugin.SelectedItem as Section;
                            this.RefreshOKButton();
                            this.RefreshLabelTextsDisplay();
                        };
                    }
                    this.GameFramePlugin.SetOKFunction(function);
                    break;

                case SectionOrientationKind.势力:
                    var list0 = Session.Current.Scenario.DiplomaticRelations.GetDiplomaticRelationDisplayListByFactionID(this.EditingFaction.ID);

                    if (list0 == null)
                    {
                        WebTools.TakeWarnMsg("list0 == null", "", new Exception("list0为空"));
                        return;
                    }

                    var list = list0.GetList();

                    this.TabListPlugin.InitialValues(list, null, InputManager.NowMouse.ScrollWheelValue, "");
                    this.TabListPlugin.SetListKindByName("DiplomaticRelation", true, false);
                    this.TabListPlugin.SetSelectedTab("");
                    this.GameFramePlugin.Kind     = FrameKind.CastTargetKind;
                    this.GameFramePlugin.Function = FrameFunction.GetSectionToDemolish;
                    this.GameFramePlugin.SetFrameContent(this.TabListPlugin.TabList, Session.MainGame.mainGameScreen.viewportSizeFull);
                    this.GameFramePlugin.OKButtonEnabled     = false;
                    this.GameFramePlugin.CancelButtonEnabled = true;
                    if (function2 == null)
                    {
                        function2 = delegate
                        {
                            this.EditingSection.OrientationSection      = null;
                            this.EditingSection.OrientationState        = null;
                            this.EditingSection.OrientationArchitecture = null;
                            DiplomaticRelationDisplay selectedItem = this.TabListPlugin.SelectedItem as DiplomaticRelationDisplay;
                            if (selectedItem.LinkedFaction1 == this.EditingFaction)
                            {
                                this.EditingSection.OrientationFaction = selectedItem.LinkedFaction2;
                            }
                            else if (selectedItem.LinkedFaction2 == this.EditingFaction)
                            {
                                this.EditingSection.OrientationFaction = selectedItem.LinkedFaction1;
                            }
                            this.RefreshOKButton();
                            this.RefreshLabelTextsDisplay();
                        };
                    }
                    this.GameFramePlugin.SetOKFunction(function2);
                    break;

                case SectionOrientationKind.州域:
                    this.TabListPlugin.InitialValues(Session.Current.Scenario.States.GetList(), null, InputManager.NowMouse.ScrollWheelValue, "");
                    this.TabListPlugin.SetListKindByName("State", true, false);
                    this.TabListPlugin.SetSelectedTab("");
                    this.GameFramePlugin.Kind     = FrameKind.SectionAIDetail;
                    this.GameFramePlugin.Function = FrameFunction.GetFaction;
                    this.GameFramePlugin.SetFrameContent(this.TabListPlugin.TabList, Session.MainGame.mainGameScreen.viewportSizeFull);
                    this.GameFramePlugin.OKButtonEnabled     = false;
                    this.GameFramePlugin.CancelButtonEnabled = true;
                    if (function3 == null)
                    {
                        function3 = delegate
                        {
                            this.EditingSection.OrientationFaction      = null;
                            this.EditingSection.OrientationSection      = null;
                            this.EditingSection.OrientationState        = this.TabListPlugin.SelectedItem as State;
                            this.EditingSection.OrientationArchitecture = null;
                            this.RefreshOKButton();
                            this.RefreshLabelTextsDisplay();
                        };
                    }
                    this.GameFramePlugin.SetOKFunction(function3);
                    break;

                case SectionOrientationKind.建筑:
                    ArchitectureList allArch    = Session.Current.Scenario.Architectures;
                    ArchitectureList targetArch = new ArchitectureList();
                    foreach (Architecture a in allArch)
                    {
                        if (a.BelongedFaction != this.EditingFaction)
                        {
                            targetArch.Add(a);
                        }
                    }
                    this.TabListPlugin.InitialValues(targetArch, null, InputManager.NowMouse.ScrollWheelValue, "");
                    this.TabListPlugin.SetListKindByName("Architecture", true, false);
                    this.TabListPlugin.SetSelectedTab("");
                    this.GameFramePlugin.Kind     = FrameKind.Architecture;
                    this.GameFramePlugin.Function = FrameFunction.GetFaction;
                    this.GameFramePlugin.SetFrameContent(this.TabListPlugin.TabList, Session.MainGame.mainGameScreen.viewportSizeFull);
                    this.GameFramePlugin.OKButtonEnabled     = false;
                    this.GameFramePlugin.CancelButtonEnabled = true;
                    if (function3 == null)
                    {
                        function3 = delegate
                        {
                            this.EditingSection.OrientationFaction      = null;
                            this.EditingSection.OrientationSection      = null;
                            this.EditingSection.OrientationState        = null;
                            this.EditingSection.OrientationArchitecture = this.TabListPlugin.SelectedItem as Architecture;
                            this.RefreshOKButton();
                            this.RefreshLabelTextsDisplay();
                        };
                    }
                    this.GameFramePlugin.SetOKFunction(function3);
                    break;
                }
                this.GameFramePlugin.IsShowing = true;
            }
            catch (Exception ex)
            {
                WebTools.TakeWarnMsg("MarshalSectionDialog.ShowOrientationFrame", "", ex);
            }
        }
コード例 #29
0
 internal void SetGameObjectBranch(GameObject gongfang, GameObject gameObject, string branchName)
 {
     this.BuildingRichText.Clear();
     if (gameObject != null)
     {
         this.BuildingRichText.AddGameObjectTextBranch(gameObject, this.TextTree.GetBranch(branchName));
     }
     else
     {
         this.BuildingRichText.AddGameObjectTextBranch(gongfang, this.TextTree.GetBranch(branchName));
     }
     if (this.HasConfirmationDialog)
     {
         this.DisplayQueue.Enqueue(new GameObjectAndBranchName(gongfang, gameObject, this.BuildingRichText.Texts, branchName, this.iConfirmationDialog, this.YesFunction, this.NoFunction));
         this.YesFunction = null;
         this.NoFunction = null;
     }
     else
     {
         this.DisplayQueue.Enqueue(new GameObjectAndBranchName(gongfang, gameObject, this.BuildingRichText.Texts, branchName, null, null, null));
     }
     this.HasConfirmationDialog = false;
 }
コード例 #30
0
 public void AddYesFunction(GameDelegates.VoidFunction yesFunction)
 {
     this.confirmationDialog.YesFunction = yesFunction;
 }
コード例 #31
0
 private bool DequeueAndDisplay()
 {
     if (this.DisplayQueue.Count > 0)
     {
         this.startShowingTime = DateTime.Now;
         GameObjectAndBranchName name = this.DisplayQueue.Dequeue();
         this.shijiantupian = this.shijiantupianduilie.Dequeue();
         this.shijiantupianjuxing = this.juxingduilie.Dequeue();
         this.SetPosition(ShowPosition.Bottom );
         this.shijianshengyin = this.shijianshengyinduilie.Dequeue();
         this.SpeakingPerson = name.person;
         this.NameText.Text = name.person.Name;
         this.RichText.Clear();
         if (this.diyigeshengyin)
         {
             this.screen.PlayNormalSound(this.shijianshengyin);
             this.diyigeshengyin = false;
         }
         if (name.gameObject == null)
         {
             this.RichText.AddText(name.branchName);
         }
         else
         {
             this.RichText.Texts = name.texts;
         }
         this.RichText.ResortTexts();
         if (name.iConfirmationDialog != null)
         {
             this.iConfirmationDialog = name.iConfirmationDialog;
             this.iConfirmationDialog.SetPersonTextDialog(this.iPersonTextDialog);
             this.iConfirmationDialog.AddYesFunction(name.YesFunction);
             this.iConfirmationDialog.AddNoFunction(name.NoFunction);
             this.iConfirmationDialog.IsShowing = true;
         }
         else
         {
             this.iConfirmationDialog = null;
             this.YesFunction = null;
             this.NoFunction = null;
         }
         return false;
     }
     return true;
 }
コード例 #32
0
 public void SetEnterFunction(GameDelegates.VoidFunction function)
 {
     this.numberInputer.EnterFunction = function;
 }
コード例 #33
0
 private bool DequeueAndDisplay()
 {
     if (this.DisplayQueue.Count > 0)
     {
         this.startShowingTime = DateTime.Now;
         GameObjectAndBranchName name = this.DisplayQueue.Dequeue();
         this.SpeakingPerson = name.person;
         this.NameText.Text = name.person.Name;
         this.RichText.Clear();
         if (name.gameObject == null)
         {
             this.RichText.AddText(name.branchName);
         }
         else
         {
             this.RichText.Texts = name.texts;
         }
         this.RichText.ResortTexts();
         if (name.iConfirmationDialog != null)
         {
             this.iConfirmationDialog = name.iConfirmationDialog;
             this.iConfirmationDialog.SetPersonTextDialog(this.iPersonTextDialog);
             this.iConfirmationDialog.AddYesFunction(name.YesFunction);
             this.iConfirmationDialog.AddNoFunction(name.NoFunction);
             this.iConfirmationDialog.IsShowing = true;
         }
         else
         {
             this.iConfirmationDialog = null;
             this.YesFunction = null;
             this.NoFunction = null;
         }
         return false;
     }
     return true;
 }
コード例 #34
0
ファイル: CreateTroopPlugin.cs プロジェクト: zhaohuwei/ZHSan
 public void SetCreateFunction(GameDelegates.VoidFunction function)
 {
     this.createTroop.CreateFunction = function;
 }
コード例 #35
0
 private void screen_OnMouseRightDown(Point position)
 {
     this.Result = DialogResult.No;
     this.screen.PlayNormalSound(this.NoSoundFile);
     if (this.NoFunction != null)
     {
         this.NoFunction();
         this.NoFunction = null;
     }
     this.IsShowing = false;
 }
コード例 #36
0
ファイル: GameFrame.cs プロジェクト: lemingcen/ZHSan
 internal void SetOKFunction(GameDelegates.VoidFunction okfunction)
 {
     this.frameContent.OKFunction = okfunction;
 }
コード例 #37
0
 public void SetCloseFunction(GameDelegates.VoidFunction closeFunction)
 {
     this.personTextDialog.CloseFunction += closeFunction;
 }