public static TextBoxString read(BinaryReader binaryReader) { var newObj = new TextBoxString(); newObj.MessageText = PStringChar.read(binaryReader); newObj.ChatMessageType = binaryReader.ReadUInt32(); return(newObj); }
private static void ScrollLog(TextBoxString textBoxString) { // If we get to the bottom of the console - the height of our font after scaling. if (textBoxString.mStringPosition.Y > TEXTBOX_HEIGHT - (mSpriteFont.MeasureString(mTypedText.mStringValue).Y * mTextScale)) { // Take every message in the log and move it up one slot. for (int i = 0; i < mMessageLogList.Count; i++) { TextBoxString temp = mMessageLogList[i]; temp.mStringPosition.Y -= mSpriteFont.MeasureString(mTypedText.mStringValue).Y * mTextScale; mMessageLogList[i] = temp; } // Move our typed text up as well. mTypedText.mStringPosition.Y -= mSpriteFont.MeasureString(mTypedText.mStringValue).Y * mTextScale; } }
public override bool acceptMessageData(BinaryReader messageDataReader, TreeView outputTreeView) { bool handled = true; PacketOpcode opcode = Util.readOpcode(messageDataReader); switch (opcode) { case PacketOpcode.Evt_Communication__Talk_ID: // 0x0015 { var message = Talk.read(messageDataReader); message.contributeToTreeView(outputTreeView); break; } case PacketOpcode.Evt_Communication__PopUpString_ID: // 0x0004 { var message = PopUpString.read(messageDataReader); message.contributeToTreeView(outputTreeView); break; } case PacketOpcode.Evt_Communication__TalkDirect_ID: // 0x0032 { var message = TalkDirect.read(messageDataReader); message.contributeToTreeView(outputTreeView); break; } case PacketOpcode.Evt_Communication__TalkDirectByName_ID: // 0x005D { var message = TalkDirectByName.read(messageDataReader); message.contributeToTreeView(outputTreeView); break; } case PacketOpcode.Evt_Communication__ChannelBroadcast_ID: // 0x0147 { var message = ChannelBroadcast.read(messageDataReader); message.contributeToTreeView(outputTreeView); break; } /*case PacketOpcode.Evt_Communication__SetSquelchDB_ID: // 0x01F4 * { * var message = SetSquelchDB.read(messageDataReader); * message.contributeToTreeView(outputTreeView); * break; * }*/ case PacketOpcode.Evt_Communication__Emote_ID: // 0x01DF { var message = Emote.read(messageDataReader); message.contributeToTreeView(outputTreeView); break; } case PacketOpcode.Evt_Communication__HearEmote_ID: // 0x01E0 { var message = HearEmote.read(messageDataReader); message.contributeToTreeView(outputTreeView); break; } case PacketOpcode.Evt_Communication__SoulEmote_ID: // 0x01E1 { var message = SoulEmote.read(messageDataReader); message.contributeToTreeView(outputTreeView); break; } case PacketOpcode.Evt_Communication__HearSoulEmote_ID: // 0x01E2 { var message = HearSoulEmote.read(messageDataReader); message.contributeToTreeView(outputTreeView); break; } case PacketOpcode.Evt_Communication__Recv_ChatRoomTracker_ID: // 0x0295 { var message = Recv_ChatRoomTracker.read(messageDataReader); message.contributeToTreeView(outputTreeView); break; } case PacketOpcode.Evt_Communication__WeenieError_ID: // 0x028A { WeenieError message = WeenieError.read(messageDataReader); message.contributeToTreeView(outputTreeView); break; } case PacketOpcode.Evt_Communication__WeenieErrorWithString_ID: // 0x028B { WeenieErrorWithString message = WeenieErrorWithString.read(messageDataReader); message.contributeToTreeView(outputTreeView); break; } case PacketOpcode.Evt_Communication__HearSpeech_ID: // 0x02BB { var message = HearSpeech.read(messageDataReader); message.contributeToTreeView(outputTreeView); break; } case PacketOpcode.Evt_Communication__HearRangedSpeech_ID: // 0x02BC { var message = HearRangedSpeech.read(messageDataReader); message.contributeToTreeView(outputTreeView); break; } case PacketOpcode.Evt_Communication__HearDirectSpeech_ID: // 0x2BD { var message = HearDirectSpeech.read(messageDataReader); message.contributeToTreeView(outputTreeView); break; } case PacketOpcode.Evt_Communication__TransientString_ID: // 0x2EB { var message = TransientString.read(messageDataReader); message.contributeToTreeView(outputTreeView); break; } case PacketOpcode.Evt_Communication__TextboxString_ID: // 0xF7E0 { var message = TextBoxString.read(messageDataReader); message.contributeToTreeView(outputTreeView); break; } default: { handled = false; break; } } return(handled); }
// Allows to print debug information even inside of a loop at a set interval. public static void WriteLineAtInterval(string debugText, GameTime gameTime, float Interval) { // Check if we should print another message yet. if (mStartTime >= Interval) { var debugString = new TextBoxString(); // Retain proper formatting and wordwrapping. debugString.mStringValue = ParseText(debugText); try { debugString.mStringPosition = mTypedText.mStringPosition; } catch (Exception e) { Console.WriteLine(e); } // Push our typed text position down below our debug string. mTypedText.mStringPosition.Y += mSpriteFont.MeasureString(mTypedText.mStringValue).Y * mTextScale; // Add the debug string to the message log list. mMessageLogList.Add(debugString); // Assure that we are scrolling properly. ScrollLog(debugString); // Reset Timer. mStartTime = 0.0f; } }
private static void CheckCommand(TextBoxString command) { var response = new TextBoxString(); // Strip whitespace from any command we send. command.mStringValue = new string(command.mStringValue.Where(c => !char.IsWhiteSpace(c)).ToArray()); //If we receive this command. if (command.mStringValue == "enspriteid") { //Type a response to the screen. response.mStringValue = "Sprite ID Text Enabled."; response.mStringPosition = command.mStringPosition; // Move our cursor below the response. mTypedText.mStringPosition.Y += mSpriteFont.MeasureString(mTypedText.mStringValue).Y * mTextScale; // Add response to the message log so that it may be displayed from the log. mMessageLogList.Add(response); EnableSpriteID(); } if (command.mStringValue == "entargetq") { //Type a response to the screen. response.mStringValue = "CurrentTarget Queue Enabled."; response.mStringPosition = command.mStringPosition; // Move our cursor below the response. mTypedText.mStringPosition.Y += mSpriteFont.MeasureString(mTypedText.mStringValue).Y * mTextScale; // Add response to the message log so that it may be displayed from the log. mMessageLogList.Add(response); EnableTargetQueue(); } else if (command.mStringValue == "engrid") { EnableGrid(); } else if (command.mStringValue == "thereisnospoon") { response.mStringValue = "CHEATER!!!"; response.mStringPosition = command.mStringPosition; // Move our cursor below the response. mTypedText.mStringPosition.Y += mSpriteFont.MeasureString(mTypedText.mStringValue).Y * mTextScale; // Add response to the message log so that it may be displayed from the log. mMessageLogList.Add(response); EnableGodModeFunction(); } }
public static void WriteLine(ref TextBoxString gameAttributeText, float mTextScale, string gameAttribute, List<TextBoxString> attributeList) { try { gameAttributeText.mStringValue = gameAttribute; attributeList.Add(gameAttributeText); } catch (Exception e) { Console.WriteLine(e); } // Move our typed text position to below the debug text. gameAttributeText.mStringPosition.Y += mSpriteFont.MeasureString(gameAttributeText.mStringValue).Y * mTextScale; }
public static void WriteLine(string debugString) { var debugText = new TextBoxString(); // Retain proper formatting and wordwrapping. debugText.mStringValue = ParseText(debugString); try { debugText.mStringPosition = mTypedText.mStringPosition; } catch (Exception e) { Console.WriteLine(e); } // Move our typed text position to below the debug text. mTypedText.mStringPosition.Y += mSpriteFont.MeasureString(mTypedText.mStringValue).Y * mTextScale; // Add the debug text to the message log. mMessageLogList.Add(debugText); // Assure that we are properly scrolling. ScrollLog(debugText); }
public static void PrintStructureAttributes(ref float textScale, ref TextBoxString gameObjectAttribute, ref List<TextBoxString> gameObjectAttributeList, ref string gameObjectAttributeString, Structure tempStructure) { //Print Strucutre Name gameObjectAttributeString = tempStructure.StructureType.ToString(); WriteLine(ref gameObjectAttribute, textScale, gameObjectAttributeString, gameObjectAttributeList); // Print Health gameObjectAttributeString = "Health: " + tempStructure.StructureAttribute.CurrentHealthPoints.ToString(); WriteLine(ref gameObjectAttribute, textScale, gameObjectAttributeString, gameObjectAttributeList); // Print Armor gameObjectAttributeString = "Armor: " + tempStructure.StructureAttribute.CurrentArmor; WriteLine(ref gameObjectAttribute, textScale, gameObjectAttributeString, gameObjectAttributeList); gameObjectAttributeString = " "; }
public static void PrintUpgradeUnitAttributes(ref float textScale, ref TextBoxString gameObjectAttribute, ref List<TextBoxString> gameObjectAttributeList, ref string gameObjectAttributeString) { //TODO: unit name, HP, armor, damage switch (tempStructure.UnitType) { case ObjectType.DRAGON: tempFriendly = GameController.FriendlyPool[7]; break; case ObjectType.NECROMANCER: tempFriendly = GameController.FriendlyPool[5]; break; case ObjectType.ARCANE_MAGE: tempFriendly = GameController.FriendlyPool[2]; break; case ObjectType.FIRE_MAGE: tempFriendly = GameController.FriendlyPool[6]; break; case ObjectType.AXE_THROWER: tempFriendly = GameController.FriendlyPool[3]; break; case ObjectType.BERSERKER: tempFriendly = GameController.FriendlyPool[1]; break; case ObjectType.WOLF: tempFriendly = GameController.FriendlyPool[0]; break; case ObjectType.CLERIC: tempFriendly = GameController.FriendlyPool[4]; break; default: throw new ArgumentOutOfRangeException(); } // Print Upgrade Stats gameObjectAttributeString = "Unit Type: " + tempStructure.UnitType + "\nHealth Points: " + tempFriendly.FriendlyAttribute.MaxHealthPoints + "\nArmor: " + tempFriendly.FriendlyAttribute.CurrentArmor + "\nDamge: " + tempFriendly.FriendlyAttribute.CurrentMinimumDamage + " - " + tempFriendly.FriendlyAttribute.CurrentMaximumDamage; WriteLine(ref gameObjectAttribute, textScale, gameObjectAttributeString, gameObjectAttributeList); gameObjectAttributeString = " "; }
public static void PrintPurchaseAttributes(ref float textScale, ref TextBoxString gameObjectAttribute, ref List<TextBoxString> gameObjectAttributeList, ref string gameObjectAttributeString) { // Print Armor gameObjectAttributeString = "Unit Type: " + tempPurchaseString + "\nGold Cost: " + tempStrucutreAttribute.Cost; WriteLine(ref gameObjectAttribute, textScale, gameObjectAttributeString, gameObjectAttributeList); gameObjectAttributeString = " "; }
public static void PrintHeroAttributes(ref float textScale, ref TextBoxString gameObjectAttribute, ref List<TextBoxString> gameObjectAttributeList, ref string gameObjectAttributeString, Hero tempHero) { // Print Name gameObjectAttributeString = "The Hero"; WriteLine(ref gameObjectAttribute, textScale, gameObjectAttributeString, gameObjectAttributeList); // Print Armor gameObjectAttributeString = "Armor: " + tempHero.HeroAttribute.CurrentArmor; WriteLine(ref gameObjectAttribute, textScale, gameObjectAttributeString, gameObjectAttributeList); //Print Level gameObjectAttributeString = "Level: " + tempHero.HeroAttribute.Level; WriteLine(ref gameObjectAttribute, textScale, gameObjectAttributeString, gameObjectAttributeList); //Print Damage gameObjectAttributeString = "Damage: " + tempHero.HeroAttribute.CurrentMinimumDamage + " - " + tempHero.HeroAttribute.CurrentMaximumDamage; WriteLine(ref gameObjectAttribute, textScale, gameObjectAttributeString, gameObjectAttributeList); gameObjectAttributeString = " "; }
public static void PrintFriendlyAttributes(ref float textScale, ref TextBoxString gameObjectAttribute, ref List<TextBoxString> gameObjectAttributeList, ref string gameObjectAttributeString, Friendly tempFriendly) { // Print Health gameObjectAttributeString = "Health: " + tempFriendly.FriendlyAttribute.CurrentHealthPoints.ToString(); WriteLine(ref gameObjectAttribute, textScale, gameObjectAttributeString, gameObjectAttributeList); // Print Armor gameObjectAttributeString = "Armor: " + tempFriendly.FriendlyAttribute.CurrentArmor; WriteLine(ref gameObjectAttribute, textScale, gameObjectAttributeString, gameObjectAttributeList); //Print Sprite Frame gameObjectAttributeString = "Damage: " + tempFriendly.FriendlyAttribute.CurrentMinimumDamage + " - " + tempFriendly.FriendlyAttribute.CurrentMaximumDamage; WriteLine(ref gameObjectAttribute, textScale, gameObjectAttributeString, gameObjectAttributeList); gameObjectAttributeString = " "; }
public static void PrintEnemyAttributes(ref float textScale, ref TextBoxString gameObjectAttribute, ref List<TextBoxString> gameObjectAttributeList, ref string gameObjectAttributeString, Enemy tempEnemy) { // Print Name gameObjectAttributeString = tempEnemy.CreatureType.ToString(); WriteLine(ref gameObjectAttribute, textScale, gameObjectAttributeString, gameObjectAttributeList); // Print Health gameObjectAttributeString = "Health: " + tempEnemy.EnemyAttribute.CurrentHealthPoints.ToString(); WriteLine(ref gameObjectAttribute, textScale, gameObjectAttributeString, gameObjectAttributeList); // Print Armor gameObjectAttributeString = "Armor: " + tempEnemy.EnemyAttribute.CurrentArmor; WriteLine(ref gameObjectAttribute, textScale, gameObjectAttributeString, gameObjectAttributeList); //Print Damage gameObjectAttributeString = "Damage: " + tempEnemy.EnemyAttribute.BaseMinimumDamage.ToString() + " - " + tempEnemy.EnemyAttribute.BaseMaximumDamage.ToString(); WriteLine(ref gameObjectAttribute, textScale, gameObjectAttributeString, gameObjectAttributeList); gameObjectAttributeString = " "; }
public static void PrintCastleAttributes(ref float textScale, ref TextBoxString gameObjectAttribute, ref List<TextBoxString> gameObjectAttributeList, ref string gameObjectAttributeString, Castle tempCastle) { textScale = .5f; //Print Name gameObjectAttributeString = "Castle Damodred"; WriteLine(ref gameObjectAttribute, textScale, gameObjectAttributeString, gameObjectAttributeList); // Print Health gameObjectAttributeString = "Health: " + tempCastle.CastleAttribute.CurrentHealthPoints.ToString(); WriteLine(ref gameObjectAttribute, textScale, gameObjectAttributeString, gameObjectAttributeList); gameObjectAttributeString = " "; }