void MoveVertical(Point pos, int ydir) { CharacterHandler handler = Handler as CharacterHandler; IViewer viewer = handler.Viewer; if (viewer != null) { Canvas canvas = handler.CurrentPage.Canvas; BitFont font = handler.CurrentPage.Font; Point newCursor = pos; float fontHeight = ((float)font.Height) * handler.ZoomRatio.Height; int verticalOffset = (int)((viewer.ViewSize.Height + fontHeight - 1) / fontHeight); newCursor.Y += verticalOffset * ydir; if (newCursor.Y > canvas.Height - 1) { newCursor.Y = canvas.Height - 1; } if (newCursor.Y < 0) { newCursor.Y = 0; } //Rectangle rect = handler.SelectedRegion; handler.CursorPosition = newCursor; /*handler.SetCursorPosition(newCursor, false); * handler.InvalidateCharacterRegion(new Rectangle(pos, new Size(1,1))); * rect.Normalize(); * rect.Width++; * rect.Height++; * * handler.InvalidateCharacterRegion(rect); */ Point scrollPos = viewer.ScrollPosition; scrollPos.Y += (int)Math.Round(verticalOffset * fontHeight) * ydir; if (scrollPos.Y < 0) { scrollPos.Y = 0; } viewer.ScrollPosition = scrollPos; /* * handler.InvalidateCharacterRegion(new Rectangle(newCursor, new Size(1,1))); * rect = handler.SelectedRegion; * rect.Normalize(); * rect.Width++; * rect.Height++; * * handler.InvalidateCharacterRegion(rect); */ } }
public override void Apply(CharacterHandler handler) { foreach (var r in Items) { r.Apply(handler); } if (CursorLocation != null) { handler.SetCursorPosition(CursorLocation.Value, true); } }
public ColourPad(CharacterHandler handler) { this.Handler = handler; this.Handler.ColourStart = start; this.Handler.DrawAttributeChanged += new EventHandler <EventArgs> (HandleColourChanged).MakeWeak((e) => this.Handler.DrawAttributeChanged -= e); this.Handler.CurrentPage.PaletteChanged += new EventHandler <EventArgs> (delegate { SetColours(); UpdateButtons(); Invalidate(); }).MakeWeak((e) => this.Handler.CurrentPage.PaletteChanged -= e); var boxSize = new Size(30, 30); int boxOffset = 10; int boxesPadding = 10; int boxesOffset = boxSize.Width + boxOffset + boxesPadding; max = 8; //Math.Min (16, Palette.Count / 2); Size = new Size(40, boxesOffset + (max * 18) + 16 + 17); foreground = new FBColourBox { Size = boxSize, Pad = this }; background = new FBColourBox { Size = boxSize, Pad = this }; SetColours(); var layout = new PixelLayout(); layout.Add(background, boxOffset, boxOffset); layout.Add(foreground, 0, 0); colours = new SelectColourBox[max * 2]; for (int i = 0; i < max; i++) { CreateButton(layout, i, 2, boxesOffset + i * 18); CreateButton(layout, i + max, 22, boxesOffset + i * 18); } layout.Add(SelectButton(), 10, this.Size.Height - 16); layout.Add(UpButton(), 2, this.Size.Height - 16 - 15); layout.Add(DownButton(), 22, this.Size.Height - 16 - 15); Content = layout; UpdateButtons(); }
private void Start() { //the character handler is the component attached to our player charH = GetComponent <CharacterHandler>(); //if we have a save key called SpawnPoint if (PlayerPrefs.HasKey("SpawnPoint")) { //then our checkpoint is equal to the game object that is named after our save file currentCheckPoint = GameObject.Find(PlayerPrefs.GetString("SpawnPoint")); //our transform.position is equal to that of the checkpoint transform.position = currentCheckPoint.transform.position; } }
void Start() { inv.Add(ItemData.CreateItem(1)); inv.Add(ItemData.CreateItem(202)); inv.Add(ItemData.CreateItem(401)); inv.Add(ItemData.CreateItem(102)); inv.Add(ItemData.CreateItem(301)); inv.Add(ItemData.CreateItem(2)); inv.Add(ItemData.CreateItem(404)); handler = GameObject.FindGameObjectWithTag("Player").GetComponent <CharacterHandler>(); }
public ICollection <string> GetCmdrs(string journalPath) { CharacterHandler ChHandler = new CharacterHandler(); EliteJournalParser Logs = new EliteJournalParser(journalPath); foreach (var entry in Logs.GetLogEntries()) { entry.Accept(ChHandler); } return(ChHandler.Cmdrs); }
public void SelectCharacter(CharacterHandler theCharacter) { selectedCharacter = theCharacter; selectedCharacter.Select(); foreach (CharacterHandler character in NegoceManager.I.allPresentCharacters) { if (character != selectedCharacter) { character.UnSelect(false); } } }
public void OpenRadialMenu(StallObject stallObject, CharacterHandler characterHandler, ExchangeSpace exchangeSpace) { currentExchangeSpace = exchangeSpace; rectTransform.position = exchangeSpace.rectTransform.position; appearAnim.GetReferences(); StartCoroutine(appearAnim.anim.PlayBackward(appearAnim, true)); currentStallObject = stallObject; objectIllustration.sprite = stallObject.linkedObject.illustration; objectNameText.text = stallObject.linkedObject.objectName; characterTargeted = characterHandler; currentPotentialObject = characterTargeted.GetPotentialFromStallObject(currentStallObject); isOpened = true; categoryRadialOptions[0].radialOption.icon.sprite = stallObject.linkedObject.features[0].categoryProperties.icon; categoryRadialOptions[0].radialOption.icon.color = stallObject.linkedObject.features[0].categoryProperties.color; categoryRadialOptions[0].feature = stallObject.linkedObject.features[0]; categoryRadialOptions[0].knownFeature = currentPotentialObject.GetKnownFeatureFromFeature(categoryRadialOptions[0].feature); categoryRadialOptions[0].radialOption.time.text = stallObject.linkedObject.features[0].categoryProperties.argumentRememberTime.ToString() + " s."; if (stallObject.linkedObject.categories.Count > 1) { categoryRadialOptions[1].radialOption.gameObject.SetActive(true); categoryRadialOptions[1].radialOption.icon.sprite = stallObject.linkedObject.features[1].categoryProperties.icon; categoryRadialOptions[1].radialOption.icon.color = stallObject.linkedObject.features[1].categoryProperties.color; categoryRadialOptions[1].feature = stallObject.linkedObject.features[1]; categoryRadialOptions[1].knownFeature = currentPotentialObject.GetKnownFeatureFromFeature(categoryRadialOptions[1].feature); categoryRadialOptions[1].radialOption.time.text = stallObject.linkedObject.features[1].categoryProperties.argumentRememberTime.ToString() + " s."; } else { categoryRadialOptions[1].radialOption.icon.color = Color.clear; categoryRadialOptions[1].radialOption.gameObject.SetActive(false); } for (int i = 0; i < featureRadialOptions.Count; i++) { if (i + 2 < stallObject.linkedObject.features.Count) { featureRadialOptions[i].radialOption.gameObject.SetActive(true); featureRadialOptions[i].radialOption.info.text = stallObject.linkedObject.features[i + 2].argumentTitle; featureRadialOptions[i].radialOption.time.text = stallObject.linkedObject.features[i + 2].rememberTime.ToString() + " s."; featureRadialOptions[i].feature = stallObject.linkedObject.features[i + 2]; featureRadialOptions[i].knownFeature = currentPotentialObject.GetKnownFeatureFromFeature(featureRadialOptions[i].feature); } else { featureRadialOptions[i].radialOption.gameObject.SetActive(false); } } }
public override IUndoItem Reciprocal(CharacterHandler handler) { var buffer = new UndoBuffer { CursorLocation = this.NextLocation, NextLocation = this.CursorLocation }; foreach (var item in Items) { buffer.Add(item.Reciprocal(handler)); } return(buffer); }
public override void Load(Stream fs, CharacterDocument doc, CharacterHandler handler) { Page page = doc.Pages[0]; BinaryReader br = new BinaryReader(fs); Canvas canvas = page.Canvas; ResizeCanvasWidth(fs, doc, canvas); Rectangle rClip = new Rectangle(0, 0, canvas.Width, canvas.Height); Point p = rClip.Location; try { //page.Palette = Palette.GetDefaultPalette (); //page.Font = BitFont.GetStandard8x16 (); CanvasElement ce = new CanvasElement(32, 7); p = rClip.Location; WaitEventArgs args = new WaitEventArgs(); while (true) { doc.OnWait(args); if (args.Exit) { break; } ce.Character = br.ReadByte(); ce.Attribute = br.ReadByte(); if (p.X < canvas.Size.Width && p.Y < canvas.Size.Height) { canvas[p] = ce; } p.X++; if (p.X > rClip.InnerRight) { p.X = rClip.Left; p.Y++; if (p.Y > rClip.InnerBottom) { canvas.ShiftUp(); p.Y = rClip.InnerBottom; } } } } catch (EndOfStreamException) { } ResizeCanvasHeight(doc, canvas, p.Y + 1); }
void Start() { controller = GetComponent <CharacterController>(); //finds the player controller component charH = GetComponent <CharacterHandler>(); myCamera = GameObject.Find("Main Camera"); //finds the camera anim = GetComponent <Animator>(); spawnPoint = transform.position; //sets spawnpoint Cursor.lockState = CursorLockMode.Locked; //locks the cursor position Cursor.visible = false; //makes the cursor invisible checkPoint = GetComponent <CheckPoint>(); stamina = staminaCap; staminaDelay = stamina; }
private void MoveTo(int x, int y) { CharacterHandler handler = Handler as CharacterHandler; Point pos = handler.CursorPosition; var newPos = new Point(x, y); newPos.Restrict(new Rectangle(handler.CurrentPage.Canvas.Size)); if (pos != newPos) { handler.CursorPosition = newPos; } }
public CharacterHandler charH; // The player CharacterHandler (need the right conditions to respawn). #endregion // Where we fetch and get stuff. #region void Start - Get Respawn Components // Start is called just before any of the Update methods is called the first time void Start() { charH = GetComponent <CharacterHandler>(); // Check PlayerPrefs to load the player's saved spawn point. if (PlayerPrefs.HasKey("SpawnPoint")) { // Set currentCheckpoint to the SpawnPoint stored in PlayerPrefs. currentCheckpoint = GameObject.Find(PlayerPrefs.GetString("SpawnPoint")); // Start the player on the currentCheckpoint position at start transform.position = currentCheckpoint.transform.position; } }
private void Start() { charH = this.GetComponent <CharacterHandler>(); //the character handler is the component attached to our player #region Check if we have Key //if we have a save key called SpawnPoint if (PlayerPrefs.HasKey("SpawnPoint")) { curCheckpoint = GameObject.Find(PlayerPrefs.GetString("SpawnPoint")); transform.position = curCheckpoint.transform.position; } #endregion }
void Start() { Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; //connect player to the player variable via tag player = GameObject.FindGameObjectWithTag("Player"); //connect Camera to the mainCam variable via tag mainCam = this.gameObject; playerCH = this.GetComponent <CharacterHandler>(); chestBox = GameObject.FindGameObjectWithTag("ChestBox"); dragChest = chestBox.GetComponent <DragAndDropChest>(); }
protected override void Execute(CommandExecuteArgs args) { CharacterHandler handler = base.Handler as CharacterHandler; var size = handler.CurrentPage.Canvas.Size; var dialog = new WidthDialog(); dialog.Width = size.Width; var result = dialog.ShowModal(handler.Viewer as Control); if (result == DialogResult.Ok) { DoResize(dialog.Width); } }
public override void Receive(Pablo.Network.ReceiveCommandArgs args) { base.Receive(args); CharacterHandler handler = this.Handler as CharacterHandler; Canvas canvas = handler.CurrentPage.Canvas; int y = args.Message.ReadVariableInt32(); var rect = new Rectangle(0, y, canvas.Width, canvas.Height - y); if (!args.IsMe) { args.Invoke(delegate { handler.Undo.Save(new UndoDeleteLine(handler, y) { CursorLocation = handler.CursorPosition }); canvas.DeleteRow(y); if (y < handler.CursorPosition.Y) { var pos = handler.CursorPosition; pos.Y--; handler.CursorPosition = pos; var scrollpos = handler.Viewer.ScrollPosition; if (scrollpos.Y > handler.CurrentPage.Font.Height) { scrollpos.Y -= handler.CurrentPage.Font.Height; handler.Viewer.ScrollPosition = scrollpos; } } if (handler.SelectedTool != null) { handler.SelectedTool.DeleteLine(y); } handler.InvalidateCharacterRegion(rect, true); }); } else { args.Invoke(delegate { handler.Undo.Save(new UndoDeleteLine(handler, y) { CursorLocation = handler.CursorPosition }); canvas.DeleteRow(y); handler.InvalidateCharacterRegion(rect, true); }); } }
public RavenClient(ILogger logger, IModuleManager moduleManager, INetworkPacketController controller) { this.logger = logger; this.Modules = moduleManager; this.client = new RavenNetworkClient(logger, RegisterPacketHandlers(controller)); this.auth = this.Modules.AddModule(new Authentication(this.client)); this.playerHandler = this.Modules.AddModule(new PlayerHandler()); this.npcHandler = this.Modules.AddModule(new NpcHandler()); this.objectHandler = this.Modules.AddModule(new ObjectHandler()); this.npcHandler = this.Modules.AddModule(new NpcHandler()); this.characterHandler = this.Modules.AddModule(new CharacterHandler()); this.chatMessageHandler = this.Modules.AddModule(new ChatMessageHandler()); }
protected override void Execute(CommandExecuteArgs args) { CharacterHandler handler = Handler as CharacterHandler; Point pos = handler.CursorPosition; base.Execute(args); // move to new position! // now we want to select from where we were to the new position // if already selecting a region, set new destination point to current position if (handler.Info.ShiftSelect && (tool.DrawMode == DrawMode.Normal)) { tool.DrawMode = DrawMode.Selecting; tool.SelectedRegion = new Rectangle(pos, handler.CursorPosition); } }
private void Start() { //the character handler is the component attached to our player charH = this.GetComponent <CharacterHandler>(); #region Check if we have Key //if we have a save key called SpawnPoint if (PlayerPrefs.HasKey("SpawnPoint")) { //then our checkpoint is equal to the game object that is named after our save file curCheckpoint = GameObject.Find(PlayerPrefs.GetString("SpawnPoint")); // Whenever you're setting up spawnpoints/checkpoints in a level, make sure that whatever they're parented to (just in order to keep them neat) is set to 0,0,0 in the world, as otherwise the children will be offset by a certain amount, and when spawnpoints are involved, that can become very f****d up (spawn and die loop) //our transform.position is equal to that of the checkpoint transform.position = curCheckpoint.transform.position; } #endregion }
public Redo(CharacterHandler handler) : base(handler) { this.ID = ActionID; this.MenuText = "&Redo"; this.ToolTip = "Redo the last action"; if (EtoEnvironment.Platform.IsMac) { this.Shortcut = CommonModifier | Keys.Shift | Keys.Z; // new [] { CommonModifier | Keys.Shift | Keys.Z, CommonModifier | Keys.Y }; } else { this.Shortcut = CommonModifier | Keys.Y; // TODO: Shortcut new [] { CommonModifier | Keys.Y, CommonModifier | Keys.Shift | Keys.Z }; } }
//Pool personnage private void Start() { CharacterHandler charHandler = GameObject.Find("DataHandler").GetComponent <CharacterHandler>(); characterPool = charHandler.LoadCharacters(); if (characterPool.Length <= 0) { Console.Error.WriteLine("Pas de personnages dans le pool"); } else { Swipe(); } }
void DoResize(int width) { CharacterHandler handler = base.Handler as CharacterHandler; var size = handler.CurrentPage.Canvas.Size; size.Width = width; handler.CurrentPage.Canvas.ResizeCanvas(size, true, true); var pos = handler.CursorPosition; pos.Restrict(new Rectangle(handler.CurrentPage.Canvas.Size)); handler.CursorPosition = pos; handler.InvalidateCharacterRegion(new Rectangle(size), true); handler.TriggerSizeChanged(); }
public static CharacterHandler GetCharacterHandlerPrefabFromTemper(Temper searchedTemper) { CharacterHandler theCharacterPrefab = null; switch (searchedTemper) { case Temper.Decisive: theCharacterPrefab = decisiveCharaPrefab; break; case Temper.OpenMinded: theCharacterPrefab = openMindedCharaPrefab; break; } return(theCharacterPrefab); }
public void AskAbout(CharaObject charaObjectAsked, CharacterHandler targetCharacter) { currentCharacterTalkingTo = targetCharacter; currentCharacterTalkingTo.isListening = true; askedCharaObject = charaObjectAsked; currentCharacterTalkingTo.Interrupt(); isWaitingForResponse = true; if (charaObjectAsked.isPersonnalValueKnown) { Speak(chatSpokenTexts[Random.Range(0, chatSpokenTexts.Length)], askTime); } else { Speak(askSpokenTexts[Random.Range(0, askSpokenTexts.Length)], askTime); } }
public static void HandleSpellUpgradeRequestMessage(Client client, SpellUpgradeRequestMessage message) { CharacterSpellRecord spellRecord = client.Character.Spells.FirstOrDefault(spell => spell.SpellId == message.spellId); if (spellRecord != null && client.Character.SpellsPoints > 0) { client.Character.SpellsPoints--; client.Send(new SpellUpgradeSuccessMessage(spellRecord.SpellId, spellRecord.Level++)); CharacterHandler.SendCharacterStatsListMessage(client); InventoryHandler.SendSpellListMessage(client); } else { client.Send(new SpellUpgradeFailureMessage()); } }
// Where we fetch and load saved player stats. #region -void Start() - Get Current Player Stats // Start is called just before any of the Update methods is called the first time private void Start() { // Just setting stuff up. Nothing really new or interesting going on here. levelRef = GetComponent <CharacterHandler>(); statArray = new string[] { "Strength", "Dexterity", "Constitution", "Intelligence", "Wisdom", "Charisma" }; level = levelRef.level; for (int i = 0; i < stats.Length; i++) { stats[i] = PlayerPrefs.GetInt(statArray[i]); } /// Garbage. /// // This was an old way I was getting stats without a for loop. /// stats = new int[] { levelRef.statSTR, levelRef.statDEX , levelRef.statCON , levelRef.statINT , levelRef.statWIS , levelRef.statCHA }; }
private void OnLevelChanged(Character character, byte currentlevel, int difference) { Friend friend = this.TryGetFriend(character); if (friend == null) { FriendsBook.logger.Error <Character>("Sad, friend bound with character {0} is not found :(", character); } else { FriendHandler.SendFriendUpdateMessage(this.Owner.Client, friend); if (this.WarnOnLevel && character.Map != this.Owner.Map) { CharacterHandler.SendCharacterLevelUpInformationMessage(this.Owner.Client, character, character.Level); } } }
public CharacterSelection(CharacterHandler handler) { this.Title = "Select Character"; this.CharacterHandler = handler; font = CharacterHandler.CurrentPage.Font; var layout = new DynamicLayout(); layout.AddCentered(Preview(), verticalCenter: false); layout.AddCentered(CharNum(), verticalCenter: false); layout.Add(Characters()); layout.BeginVertical(Padding.Empty); layout.AddRow(null, CancelButton(), OkButton()); layout.EndVertical(); Content = layout; }
private void UpdateAbilitiesDisplay(CharacterHandler player, Image abilities) { Sprite newSprite = abilities.sprite; int djCharges = player.mB.doubleJumpCharges; int dashCharges = player.mB.dashCharges; if (djCharges == 0 && dashCharges == 0) { newSprite = ability00; } else if (djCharges == 0 && dashCharges == 1) { newSprite = ability01; } else if (djCharges == 0 && dashCharges == 2) { newSprite = ability02; } else if (djCharges == 1 && dashCharges == 0) { newSprite = ability10; } else if (djCharges == 1 && dashCharges == 1) { newSprite = ability11; } else if (djCharges == 1 && dashCharges == 2) { newSprite = ability12; } else if (djCharges == 2 && dashCharges == 0) { newSprite = ability20; } else if (djCharges == 2 && dashCharges == 1) { newSprite = ability21; } else if (djCharges == 2 && dashCharges == 2) { newSprite = ability22; } abilities.overrideSprite = newSprite; }