/// <summary> /// Set initial position for given item. /// Accordingly old positions, default positions,.. /// </summary> /// <param name="item">Item which position will be set</param> /// <param name="cursor">Cursor used for position initialization.</param> private void setInitialPosition(PositionCursor cursor, DiagramItem item) { Point oldPosition; if (item.HasPosition) { //keep preset position oldPosition = item.GlobalPosition; } else { if (!_oldPositions.ContainsKey(item.ParentID)) { //there is no old position for item cursor.SetDefault(item); return; } var parentPositions = _oldPositions[item.ParentID]; if (!parentPositions.ContainsKey(item.ID)) { //there is no old position for item cursor.SetDefault(item); return; } //keep position from previous display oldPosition = parentPositions[item.ID]; } cursor.RegisterPosition(item, oldPosition); }
private static void StartMenu() { PositionCursor.Textbox(new string[] { "Welcome, human. This adventure will be quite linear. I hope to remedy that in the future, but first; tell me your name...", "In 3 months or so. Or less then that. I need time to develop this. As it is now, it's quite unfinshed. This just needs to be realesed before the End of March.", "Now, I shall see you later." }, new Vector2D(PositionUpLeft.X + 5, PositionUpLeft.Y + 5), new Vector2D(PositionDownRight.X - 5, PositionDownRight.Y - 20), horizontalBuffer: 4, verticalBuffer: 5, userContinue: true, clearAfterParagrahp: false); }
/// <summary> /// Display all registered root items /// </summary> internal void Display() { _rootCursor = null; foreach (var item in _rootItems) { Output.Children.Add(item); } }
private void BotControlled() { if (gameObject.GetComponent("GUIPlayer")) { Destroy(gameObject.GetComponent("GUIPlayer")); } fireRocketData = hatchControl.AddComponent("LaunchRocket") as LaunchRocket; fireShellData = gun.AddComponent("LaunchShell") as LaunchShell; movement = gameObject.AddComponent("SetPosition") as SetPosition; positionCursorData = gunShieldControl.AddComponent("SetCursor") as SetCursor; lazerDetectorData = GameObject.Find(user + "Lazer").AddComponent("LazerDetector") as LazerDetector; gameObject.tag = "Bot"; }
/// <summary> /// Set initial positions of given children /// </summary> /// <param name="parent">Parent of children</param> /// <param name="container">Container where children are displayed</param> /// <param name="children">Children which positions will be initialized</param> private void setInitialPositions(DiagramItem parent, DiagramCanvasBase container, IEnumerable <DiagramItem> children) { var isRoot = parent == null; var lastCursor = isRoot ? _rootCursor : parent.PositionCursor; var needsInitialPositions = lastCursor == null; if (needsInitialPositions) { var cursor = new PositionCursor(); Size lastLayoutSize; if (isRoot) { //root has no owner, because of that has special cursor _rootCursor = cursor; //we dont want to limit size of root canvas lastLayoutSize = new Size(); } else { //owner should keep their cursors parent.PositionCursor = cursor; lastLayoutSize = container.DesiredSize; } //inform cursor about items foreach (var child in children) { setInitialPosition(cursor, child); } //update positions of children cursor.UpdatePositions(lastLayoutSize); } foreach (var child in children) { child.GlobalPosition = checkBounds(child, child.GlobalPosition); } }
private void PlayerControlled() { gameObject.tag = "Player"; //Player Modules if (!gameObject.GetComponent("GUIPlayer")) { playerGUI = gameObject.AddComponent("GUIPlayer") as GUIPlayer; } if (!gameObject.GetComponent("GUITexture")) { playerGuiTexture = gameObject.AddComponent("GUITexture") as GUITexture; } fireRocketData = hatchControl.AddComponent("PlayerLaunchRocket") as PlayerLaunchRocket; fireShellData = gun.AddComponent("PlayerLaunchShell") as PlayerLaunchShell; movement = gameObject.AddComponent("PlayerMovement") as PlayerMovement; positionCursorData = gunShieldControl.AddComponent("FollowCursor") as FollowCursor; AudioListener playerAudioListener = gameObject.AddComponent("AudioListener") as AudioListener; }
public CursorMovedEventArgs(PositionCursor c) { Cursor = c; PreviousPosition = c.Position; ModifierKeys = Control.ModifierKeys; }
private void BotControlled() { if(gameObject.GetComponent("GUIPlayer")) { Destroy(gameObject.GetComponent("GUIPlayer")); } fireRocketData = hatchControl.AddComponent("LaunchRocket") as LaunchRocket; fireShellData = gun.AddComponent("LaunchShell") as LaunchShell; movement = gameObject.AddComponent("SetPosition") as SetPosition; positionCursorData = gunShieldControl.AddComponent("SetCursor") as SetCursor; lazerDetectorData = GameObject.Find(user + "Lazer").AddComponent("LazerDetector") as LazerDetector; gameObject.tag = "Bot"; }
private void PlayerControlled() { gameObject.tag = "Player"; //Player Modules if(!gameObject.GetComponent("GUIPlayer")) { playerGUI = gameObject.AddComponent("GUIPlayer") as GUIPlayer; } if(!gameObject.GetComponent("GUITexture")) { playerGuiTexture = gameObject.AddComponent("GUITexture") as GUITexture; } fireRocketData = hatchControl.AddComponent("PlayerLaunchRocket") as PlayerLaunchRocket; fireShellData = gun.AddComponent("PlayerLaunchShell") as PlayerLaunchShell; movement = gameObject.AddComponent("PlayerMovement") as PlayerMovement; positionCursorData = gunShieldControl.AddComponent("FollowCursor") as FollowCursor; AudioListener playerAudioListener = gameObject.AddComponent("AudioListener") as AudioListener; }
private static void StartGraphics() { PositionCursor.Square(PositionUpLeft, PositionDownRight, "O", 2); PositionCursor.Square(new Vector2D(PositionUpLeft.X + 1, PositionUpLeft.Y + 1), new Vector2D(PositionDownRight.X - 1, PositionDownRight.Y - 1), "_", 2); PositionCursor.Line(new Vector2D(PositionUpLeft.X + 3, PositionDownRight.Y - 2), new Vector2D(PositionDownRight.X - 2, PositionDownRight.Y - 2), "-", 6); }