public void CreateNewNode(GameObject gameObject, Node current) { Node newNode = new Node(gameObject); current.nextNode.previousNode = newNode; newNode.nextNode = current.nextNode; newNode.previousNode = current; current.nextNode = newNode; }
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; }
private void FrameFunction_Architecture_AfterGetAwardTreasure() // 赏赐宝物 { this.CurrentGameObject = this.mainGameScreen.Plugins.TabListPlugin.SelectedItem as GameObject; if (this.CurrentGameObject != null) { Treasure currentGameObject = this.CurrentGameObject as Treasure; if (currentGameObject.BelongedPerson != null) { this.mainGameScreen.ShowTabListInFrame(UndoneWorkKind.Frame, FrameKind.Person, FrameFunction.GetAwardTreasurePerson, false, true, true, false, this.CurrentArchitecture.GetPersonListExceptLeader(), null, "", ""); } } }
private void DrawHud(GameObject hud) { this.DrawLogo(); var hudInstance = (Hud) hud; foreach (TextBlock element in hudInstance.DynamicElements.Values) { this._canvas.Children.Add(element); } foreach (Label element in hudInstance.StaticElements) { this._canvas.Children.Add(element); } }
internal void AddBranch(GameObject gameObject, string branchName, Point position) { int num = this.Record.TopAddGameObjectTextBranch(gameObject, this.TextTree.GetBranch(branchName)); this.Positions.Insert(0, position); this.MoveRectangleDown(this.Record.RowHeight * num); int index = this.Record.ClientHeight / this.Record.RowHeight; if (index < this.Positions.Count) { this.Positions.RemoveRange(index, this.Positions.Count - index); this.PositionRectangles.RemoveRange(index, this.PositionRectangles.Count - index); } this.screen.PlayNormalSound(this.PopSoundFile); this.ButtonDrawingColor = Color.Lime; this.ButtonDrawingTime = DateTime.Now; }
public Projectile(ObjectType mObjectType, SpriteState defaultState, Vector2 SpritePosition, Hostility hostility, GameObject mProjectileTargetObject, GameObject mProjectileCaster, float mProjectileDamage, ContentManager content) : base(mObjectType, content, defaultState, SpritePosition, hostility) { mObjectID = mGlobalID; mGlobalID++; mSpeed = 5.0f; randomNumberGenerator = new Random(); this.mProjectileDamage = mProjectileDamage; this.mProjectileCaster = mProjectileCaster; this.mProjectileTargetObject = mProjectileTargetObject; this.mCurrentTarget = mProjectileTargetObject.Sprite.WorldPosition; this.mTrackingNumber = this.mProjectileTargetObject.mObjectID; mHasLanded = false; }
public void AddGameObjectTextBranch(GameObject gameObject, GameObjectTextBranch branch) { if ((branch != null) && (branch.Leaves.Count != 0)) { foreach (GameObjectTextLeaf leaf in branch.Leaves) { if ((gameObject != null) && (leaf.Property != "")) { this.AddText(StaticMethods.GetPropertyValue(gameObject, leaf.Property).ToString(), leaf.TextColor); } else { this.AddText(leaf.Text, leaf.TextColor); } } this.ResortTexts(); } }
// 没收 private void FrameFunction_Architecture_AfterGetConfiscateTreasure() { this.CurrentGameObject = this.mainGameScreen.Plugins.TabListPlugin.SelectedItem as GameObject; if (this.CurrentGameObject != null) { Treasure currentGameObject = this.CurrentGameObject as Treasure; if (currentGameObject.BelongedPerson != null) { currentGameObject.BelongedPerson.ConfiscatedTreasure(currentGameObject); this.CurrentArchitecture.BelongedFaction.Leader.ReceiveTreasure(currentGameObject); } } }
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; }
public void InsertLast(GameObject gameObject) { Node newNode = new Node(gameObject); if (IsEmpty()) { mFirstNode = newNode; // FirstNode == new Node } else { mLastNode.nextNode = newNode; // oldLastNode ---> newNode newNode.previousNode = mLastNode; // previousNode ---> LastNode } mLastNode = newNode; // NewLink <---last mCount++; }
public void InsertFirst(GameObject gameObject) { Node newNode = new Node(gameObject); if (IsEmpty()) { mLastNode = newNode; } else { mFirstNode.previousNode = newNode; // newNode <----- oldFirstNode } newNode.nextNode = mFirstNode; // newNode ------>oldFirstNode mFirstNode = newNode; // FirstNode ----> newNode mCount++; }
public void InsertTarget(GameObject target) { mTargetList.InsertLast(target); }
public void Add(GameObject t) { if (immutable) throw new Exception("Trying to add things to an immutable list"); this.gameObjects.Add(t); }
public void Remove(GameObject gameObject) { if (immutable) throw new Exception("Trying to remove things to an immutable list"); this.gameObjects.RemoveAll(delegate(GameObject o) { return o == gameObject; } ); //this.gameObjects.Remove(gameObject); }
private void DrowGo(GameObject go) { var avatarSource = new BitmapImage(); avatarSource.BeginInit(); avatarSource.UriSource = new Uri(go.AvatarUri, UriKind.Relative); avatarSource.EndInit(); var avatar = new Image { Source = avatarSource, Width = go.Size.Width, Height = go.Size.Height }; Canvas.SetLeft(avatar, go.Position.Left); Canvas.SetTop(avatar, go.Position.Top); this._canvas.Children.Add(avatar); }
public void ScanGlobalList(Friendly friendlyActor) { GameObject.mPotentialTargetListList.Reset(); // Check the global list to see if another object's sprite frame intersects our FOV. // If so // InsertTargetIntoQueue for (int i = 0; i < GameObject.mPotentialTargetListList.GetCount(); i++) { currentTarget = GameObject.mPotentialTargetListList.GetCurrent().gameObject; // If my field of view intersects another object's frame. // And if the other object is not an friendlyActor. // And if the other object is not a castle. // And if the other object is not a structure. if (friendlyActor.FieldOfView.Intersects(currentTarget.Sprite.SpriteFrame) && currentTarget.Hostility != Hostility.FRIENDLY && currentTarget.Hostility != Hostility.CASTLE && currentTarget.Hostility != Hostility.STRUCTURE) { // Reset current node back to first node. friendlyActor.TargetQueue.mTargetList.Reset(); // Check to make sure he is not already in my queue. isInQueue = false; for (int j = 0; j < friendlyActor.TargetQueue.mTargetList.GetCount(); j++) { if (currentTarget.ObjectID == friendlyActor.TargetQueue.mTargetList.GetCurrent().gameObject.ObjectID) { isInQueue = true; } // Go to next node in Queue friendlyActor.TargetQueue.mTargetList.NextNode(); } if (!isInQueue) { InsertTargetIntoQueue(friendlyActor); } } GameObject.mPotentialTargetListList.NextNode(); } }
public void Add(GameObject t) { this.gameObjects.Add(t); }
public void Remove(GameObject gameObject) { this.gameObjects.RemoveAll(delegate(GameObject o) { return o == gameObject; } ); //this.gameObjects.Remove(gameObject); }
public bool HasGameObject(GameObject t) { return (this.gameObjects.IndexOf(t) >= 0); }
private void screen_OnMouseLeftDown(Point position) { if (StaticMethods.PointInRectangle(position, this.ToolDisplayPosition)) { this.xianshiyoucelan = !this.xianshiyoucelan ; if (true) //base.Enabled) { if (this.xianshiyoucelan) { this.ToolDisplayTexture = this.ToolSelectedTexture; } else { this.ToolDisplayTexture = this.ToolTexture; } } } if (this.xianshiyoucelan && (this.screen.PeekUndoneWork().Kind == UndoneWorkKind.None) && StaticMethods.PointInRectangle(position, this.RealClient)) { if (position.Y < this.listKindToDisplay.ColumnsTop) { Tab tab = this.FindTabByPosition(position); if (tab != null) { tab.Selected = true; } } else if (position.Y < (this.listKindToDisplay.ColumnsTop + this.columnheaderHeight)) { Column columnByPosition = this.GetColumnByPosition(position); if (columnByPosition != null) { PropertyComparer comparer = new PropertyComparer(columnByPosition.Name, columnByPosition.IsNumber, columnByPosition.SmallToBig); this.gameObjectList.Sort(comparer); this.listKindToDisplay.ResetAllTextures(); columnByPosition.SmallToBig = !columnByPosition.SmallToBig; } } else { GameObject gameObjectByPosition; if (this.ShowCheckBox) { gameObjectByPosition = this.GetGameObjectByPosition(position); if (gameObjectByPosition != null) { if (this.listKindToDisplay.IsInEditableColumn(position)) { if ((gameObjectByPosition.Selected || (this.SelectedItemMaxCount <= 0)) || (this.gameObjectList.GetSelectedList().Count < this.SelectedItemMaxCount)) { gameObjectByPosition.Selected = !gameObjectByPosition.Selected; if (this.MultiSelecting) { this.SelectingRows = true; this.SelectingBool = gameObjectByPosition.Selected; this.SelectedItemList = this.gameObjectList.GetSelectedList(); } else { this.gameObjectList.SetOtherUnSelected(gameObjectByPosition); } this.OKButtonEnabled = this.gameObjectList.HasSelectedItem() || (gameObjectByPosition is Faction); this.ResetEditableTextures(); if (gameObjectByPosition.Selected) { this.SelectedItem = gameObjectByPosition; if (!(this.MultiSelecting || !GlobalVariables.SingleSelectionOneClick)) { this.iGameFrame.OK(); } else { this.screen.PlayNormalSound(this.SelectSoundFile); } } else { this.SelectedItem = null; } } } else { if (gameObjectByPosition is Troop) { if ((this.iTroopDetail != null) && (this.Function != FrameFunction.Jump)) { this.iTroopDetail.SetPosition(ShowPosition.Center); this.iTroopDetail.SetTroop(gameObjectByPosition); this.iTroopDetail.IsShowing = true; } this.screen.JumpTo((gameObjectByPosition as Troop).Position); } else if (gameObjectByPosition is Person) { if ((this.iPersonDetail != null) && (this.Function != FrameFunction.Jump)) { this.iPersonDetail.SetPosition(ShowPosition.Center); this.iPersonDetail.SetPerson(gameObjectByPosition); this.iPersonDetail.IsShowing = true; } if (!(gameObjectByPosition as Person).IsCaptive) { this.screen.JumpTo((gameObjectByPosition as Person).Position); } } else if (gameObjectByPosition is Architecture) { if ((this.iArchitectureDetail != null) && (this.Function != FrameFunction.Jump)) { this.iArchitectureDetail.SetPosition(ShowPosition.Center); this.iArchitectureDetail.SetArchitecture(gameObjectByPosition); this.iArchitectureDetail.IsShowing = true; } this.screen.JumpTo((gameObjectByPosition as Architecture).Position); } else if (gameObjectByPosition is Military) { this.screen.JumpTo((gameObjectByPosition as Military).Position); } else if (gameObjectByPosition is Faction) { if ((this.iFactionTechniques != null) && (this.Function != FrameFunction.Jump)) { this.iFactionTechniques.SetArchitecture(null); this.iFactionTechniques.SetFaction(gameObjectByPosition, false); this.iFactionTechniques.SetPosition(ShowPosition.Center); this.iFactionTechniques.IsShowing = true; } this.screen.JumpTo((gameObjectByPosition as Faction).Leader.Position); } else if (gameObjectByPosition is Captive) { if ((this.iPersonDetail != null) && (this.Function != FrameFunction.Jump)) { this.iPersonDetail.SetPosition(ShowPosition.Center); this.iPersonDetail.SetPerson((gameObjectByPosition as Captive).CaptivePerson); this.iPersonDetail.IsShowing = true; } } else if (gameObjectByPosition is Treasure) { if ((this.iTreasureDetail != null) && (this.Function != FrameFunction.Jump)) { this.iTreasureDetail.SetPosition(ShowPosition.Center); this.iTreasureDetail.SetTreasure(gameObjectByPosition); this.iTreasureDetail.IsShowing = true; } if ((gameObjectByPosition as Treasure).BelongedPerson != null) { this.screen.JumpTo((gameObjectByPosition as Treasure).BelongedPerson.Position); } } if (gameObjectByPosition != null) { this.TriggerItemClick(); } } } } else { gameObjectByPosition = this.GetGameObjectByPosition(position); if (gameObjectByPosition != null) { if (this.listKindToDisplay.SelectedTab.ListMethod != null) { this.PushSubKindByName(this.listKindToDisplay.SelectedTab.ListKind, StaticMethods.GetListMethodValue(gameObjectByPosition, this.listKindToDisplay.SelectedTab.ListMethod) as GameObjectList); } else { if (gameObjectByPosition is Troop) { if ((this.iTroopDetail != null) && (this.Function != FrameFunction.Jump)) { this.iTroopDetail.SetPosition(ShowPosition.Center); this.iTroopDetail.SetTroop(gameObjectByPosition); this.iTroopDetail.IsShowing = true; } this.screen.JumpTo((gameObjectByPosition as Troop).Position); } else if (gameObjectByPosition is Person) { if ((this.iPersonDetail != null) && (this.Function != FrameFunction.Jump)) { this.iPersonDetail.SetPosition(ShowPosition.Center); this.iPersonDetail.SetPerson(gameObjectByPosition); this.iPersonDetail.IsShowing = true; } if (!(gameObjectByPosition as Person).IsCaptive) { this.screen.JumpTo((gameObjectByPosition as Person).Position); } } else if (gameObjectByPosition is Architecture) { if ((this.iArchitectureDetail != null) && (this.Function != FrameFunction.Jump)) { this.iArchitectureDetail.SetPosition(ShowPosition.Center); this.iArchitectureDetail.SetArchitecture(gameObjectByPosition); this.iArchitectureDetail.IsShowing = true; } this.screen.JumpTo((gameObjectByPosition as Architecture).Position); } else if (gameObjectByPosition is Military) { this.screen.JumpTo((gameObjectByPosition as Military).Position); } else if (gameObjectByPosition is Faction) { if ((this.iFactionTechniques != null) && (this.Function != FrameFunction.Jump)) { this.iFactionTechniques.SetArchitecture(null); this.iFactionTechniques.SetFaction(gameObjectByPosition, false); this.iFactionTechniques.SetPosition(ShowPosition.Center); this.iFactionTechniques.IsShowing = true; } this.screen.JumpTo((gameObjectByPosition as Faction).Leader.Position); } else if (gameObjectByPosition is Captive) { if ((this.iPersonDetail != null) && (this.Function != FrameFunction.Jump)) { this.iPersonDetail.SetPosition(ShowPosition.Center); this.iPersonDetail.SetPerson((gameObjectByPosition as Captive).CaptivePerson); this.iPersonDetail.IsShowing = true; } } else if (gameObjectByPosition is Treasure) { if ((this.iTreasureDetail != null) && (this.Function != FrameFunction.Jump)) { this.iTreasureDetail.SetPosition(ShowPosition.Center); this.iTreasureDetail.SetTreasure(gameObjectByPosition); this.iTreasureDetail.IsShowing = true; } if ((gameObjectByPosition as Treasure).BelongedPerson != null) { this.screen.JumpTo((gameObjectByPosition as Treasure).BelongedPerson.Position); } } if (gameObjectByPosition != null) { this.TriggerItemClick(); } } } } } } }
public int IndexOf(GameObject t) { return this.gameObjects.IndexOf(t); }
public Node(GameObject gameObject) { this.gameObject = gameObject; }
public void SetOtherUnSelected(GameObject selectedT) { foreach (GameObject obj2 in this.gameObjects) { if (obj2 != selectedT) { obj2.Selected = false; } } }
private void screen_OnMouseLeftDown(Point position) { if ((this.screen.PeekUndoneWork().Kind == UndoneWorkKind.Frame) && StaticMethods.PointInRectangle(position, base.RealClient)) { if (position.Y < this.listKindToDisplay.ColumnsTop) { } else if (position.Y < (this.listKindToDisplay.ColumnsTop + this.columnheaderHeight)) { } else { GameObject gameObjectByPosition; if (this.ShowCheckBox) { gameObjectByPosition = this.GetGameObjectByPosition(position); if (gameObjectByPosition != null) { if (this.listKindToDisplay.IsInEditableColumn(position)) { if ((gameObjectByPosition.Selected || (this.SelectedItemMaxCount <= 0)) || (this.gameObjectList.GetSelectedList().Count < this.SelectedItemMaxCount)) { if (this.MultiSelecting) { gameObjectByPosition.Selected = !gameObjectByPosition.Selected; this.SelectingRows = true; this.SelectingBool = gameObjectByPosition.Selected; this.SelectedItemList = this.gameObjectList.GetSelectedList(); } else { } base.OKButtonEnabled = this.gameObjectList.HasSelectedItem() || (gameObjectByPosition is Faction); this.ResetEditableTextures(); if (gameObjectByPosition.Selected) { this.SelectedItem = gameObjectByPosition; if (!(this.MultiSelecting || !GlobalVariables.SingleSelectionOneClick)) { //this.iGameFrame.OK(); } else { this.screen.PlayNormalSound(this.SelectSoundFile); } } else { this.SelectedItem = null; } } } else { } } } else { } } } }
internal void RefreshEditable() { this.ResetEditableTextures(); this.OKButtonEnabled = this.gameObjectList.HasSelectedItem(); if (this.MultiSelecting) { this.SelectedItemList = this.gameObjectList.GetSelectedList(); } else if (this.OKButtonEnabled) { this.SelectedItem = this.gameObjectList.GetSelectedList()[0]; } }
public int TopAddGameObjectTextBranch(GameObject gameObject, GameObjectTextBranch branch) { if (branch != null) { if (branch.Leaves.Count == 0) { return 0; } for (int i = branch.Leaves.Count - 1; i >= 0; i--) { GameObjectTextLeaf leaf = branch.Leaves[i]; if ((gameObject != null) && (leaf.Property != "")) { this.AddText(0, StaticMethods.GetPropertyValue(gameObject, leaf.Property).ToString(), leaf.TextColor); } else { this.AddText(0, leaf.Text, leaf.TextColor); } } this.ResortTexts(); foreach (SimpleText text in this.Texts) { if (text.NewLine) { return text.Row; } } } return 0; }
private void screen_OnMouseMove(Point position, bool leftDown) { if (!this.xianshiyoucelan) return; if ((this.screen.PeekUndoneWork().Kind == UndoneWorkKind.None) && (this.oldMousePosition != position)) { if (leftDown) { if (this.ShowCheckBox && ((this.MultiSelecting && !this.MovingHorizontalScrollBar) && !this.MovingVerticalScrollBar)) { GameObject gameObjectByPosition = this.GetGameObjectByPosition(position); if (gameObjectByPosition != null) { if (!this.SelectingRows) { this.SelectingRows = true; this.SelectingBool = gameObjectByPosition.Selected; } if (this.SelectingRows) { if (this.SelectingBool) { if ((this.SelectedItemMaxCount <= 0) || (this.gameObjectList.GetSelectedList().Count < this.SelectedItemMaxCount)) { gameObjectByPosition.Selected = this.SelectingBool; this.ResetEditableTextures(); } } else { gameObjectByPosition.Selected = this.SelectingBool; this.ResetEditableTextures(); } } this.OKButtonEnabled = this.gameObjectList.HasSelectedItem(); this.SelectedItemList = this.gameObjectList.GetSelectedList(); } } if (this.ShowHorizontalScrollBar && (this.MovingHorizontalScrollBar || StaticMethods.PointInRectangle(position, this.listKindToDisplay.HorizontalScrollBar))) { this.listKindToDisplay.MoveHorizontal(position.X - this.oldMousePosition.X); this.MovingHorizontalScrollBar = true; } if (this.ShowVerticalScrollBar && (this.MovingVerticalScrollBar || StaticMethods.PointInRectangle(position, this.listKindToDisplay.VerticalScrollBar))) { this.listKindToDisplay.MoveVertical(position.Y - this.oldMousePosition.Y); this.MovingVerticalScrollBar = true; } } else { int rowTopByPosition = this.GetRowTopByPosition(position); if (rowTopByPosition >= 0) { this.Focused = rowTopByPosition; this.FocusedObject = this.GetGameObjectByPosition(position); this.DrawFocused = true; } else { this.DrawFocused = false; } } this.oldMousePosition = position; } }
internal static void ListenForSelectedUnit() { GameObject.mInPlayObjectList.Reset(); for (int i = 0; i < GameObject.mInPlayObjectList.GetCount(); i++) { if (GameObject.mInPlayObjectList.GetCurrent().gameObject.Sprite.SpriteFrame. Contains(mouseRectangle) || GameObject.mInPlayObjectList.GetCurrent().gameObject.Sprite.SpriteFrame. Intersects(mouseRectangle)) { if (GameObject.mInPlayObjectList.GetCurrent().gameObject.Hostility == Hostility.STRUCTURE) { ListenForUpgrade(); break; } else { tempObject = GameObject.mInPlayObjectList.GetCurrent().gameObject; StatusWindow.SetDrawText(DrawSelectedUnit); StatusWindow.StatusWindowState = StatusWindowState.ACTIVE; break; } } else { StatusWindow.StatusWindowState = StatusWindowState.INACTIVE; } GameObject.mInPlayObjectList.NextNode(); } }