public void ShowDefeinePanel() { DefinePanel.Visible = true; DefineText.Visible = true; DefinePanel.AutoScroll = true; List <DefineUnit> defineList = CompileController.Instance.defineList; for (int i = 1; i < defineList.Count; i++) { DefineText.AppendText(i + ". "); RichTextAppeedStr(DefineText, defineList[i].name, nameColor); DefineText.AppendText(" "); RichTextAppeedStr(DefineText, defineList[i].type.ToString(), typeColor); DefineText.AppendText(" "); RichTextAppeedStr(DefineText, defineList[i].value.ToString(), valueColor); DefineText.AppendText(" "); RichTextAppeedStr(DefineText, defineList[i].funcName, levelColor); DefineText.AppendText(" "); RichTextAppeedStr(DefineText, defineList[i].address.ToString(), addressColor); DefineText.AppendText(" "); RichTextAppeedStr(DefineText, defineList[i].size.ToString(), sizeColor); DefineText.AppendText("\r\n"); } double size = 27.5 * DefineText.Lines.Length; DefineText.Height = (int)Math.Ceiling(size); if (!DefinePanel.Controls.Contains(DefineText)) { DefinePanel.Controls.Add(DefineText); } }
/// <inheritdoc /> public void SendDefinedText(IPlayerEntity player, DefineText textId) { using var packet = new FFPacket(); packet.StartNewMergedPacket(player.Id, SnapshotType.DEFINEDTEXT1); packet.Write((int)textId); SendToPlayer(player, packet); }
/// <summary> /// Shows a defined text at the client. /// </summary> /// <param name="player"></param> /// <param name="textId"></param> public static void SendDefinedText(IPlayerEntity player, DefineText textId) { using (var packet = new FFPacket()) { packet.StartNewMergedPacket(player.Id, SnapshotType.DEFINEDTEXT1); packet.Write((int)textId); player.Connection.Send(packet); } }
/// <inheritdoc /> public void SendDefinedText(IPlayerEntity player, DefineText textId, params object[] parameters) { using var packet = new FFPacket(); packet.StartNewMergedPacket(player.Id, SnapshotType.DEFINEDTEXT); packet.Write((int)textId); packet.Write(string.Join(" ", parameters)); SendToPlayer(player, packet); }
/// <summary> /// Shows a defined text at the client and replaces parameter in the string /// </summary> /// <param name="player"></param> /// <param name="textId"></param> /// <param name="stringParameter"></param> public static void SendDefinedText(IPlayerEntity player, DefineText textId, params string[] stringParameter) { using (var packet = new FFPacket()) { packet.StartNewMergedPacket(player.Id, SnapshotType.DEFINEDTEXT); packet.Write((int)textId); packet.Write(String.Join(" ", stringParameter)); player.Connection.Send(packet); } }
/// <summary> /// Check if the item to trade is valid. /// </summary> /// <param name="player">Current player.</param> /// <param name="itemToTrade">Item to trade.</param> /// <param name="errorText">Output error text if item is not valid.</param> /// <returns>True if item is valid; false otherwise.</returns> private bool IsTradeItemValid(IPlayerEntity player, Item itemToTrade, out DefineText errorText) { errorText = DefineText.TID_BLANK; if (itemToTrade.ExtraUsed != 0) { errorText = DefineText.TID_GAME_CANNOTTRADE_ITEM; return(false); } if (player.Inventory.IsItemEquiped(itemToTrade)) { errorText = DefineText.TID_GAME_CANNOTTRADE_ITEM; return(false); } return(true); }
public override void defineText2(DefineText tag) { defineText(tag); }
private void encodeDefineText(DefineText tag, SwfEncoder w, int type) { int id = dict.add(tag); w.writeUI16(id); encodeRect(tag.bounds, w); encodeMatrix(tag.matrix, w); int length = tag.records.Count; // compute necessary bit width int glyphBits = 0; int advanceBits = 0; for (int i = 0; i < length; i++) { TextRecord tr = (TextRecord) tag.records[i]; for (int j = 0; j < tr.entries.Length; j++) { GlyphEntry entry = tr.entries[j]; while (entry.Index > (1 << glyphBits)) glyphBits++; while (System.Math.Abs(entry.advance) > (1 << advanceBits)) advanceBits++; } } // increment to get from bit index to bit count. ++glyphBits; ++advanceBits; w.writeUI8(glyphBits); w.writeUI8(++advanceBits); // add one extra bit because advances are signed for (int i = 0; i < length; i++) { TextRecord record = (TextRecord) tag.records[i]; encodeTextRecord(record, w, type, glyphBits, advanceBits); } w.writeUI8(0); }
public override void defineText(DefineText tag) { encodeDefineText(tag, tagw, tag.code); encodeTag(tag); }
public override void defineText2(DefineText tag) { tags.Add(tag); }
/// <inheritdoc /> public bool CanUseSkill(IPlayerEntity player, SkillInfo skill) { if (skill.Level <= 0 || skill.Level > skill.Data.SkillLevels.Count) { return(false); } if (!skill.IsCoolTimeElapsed()) { _textPacketFactory.SendDefinedText(player, DefineText.TID_GAME_SKILLWAITTIME); return(false); } if (skill.LevelData.RequiredMP > 0 && player.Attributes[DefineAttributes.MP] < skill.LevelData.RequiredMP) { _textPacketFactory.SendDefinedText(player, DefineText.TID_GAME_REQMP); return(false); } if (skill.LevelData.RequiredFP > 0 && player.Attributes[DefineAttributes.FP] < skill.LevelData.RequiredFP) { _textPacketFactory.SendDefinedText(player, DefineText.TID_GAME_REQFP); return(false); } Item rightWeapon = player.Inventory.GetEquipedItem(ItemPartType.RightWeapon); if (skill.Data.LinkKind.HasValue) { bool playerHasCorrectWeapon; ItemKind3?rightWeaponKind = rightWeapon?.Data?.ItemKind3; switch (skill.Data.LinkKind) { case ItemKind3.MAGICBOTH: playerHasCorrectWeapon = !rightWeaponKind.HasValue || rightWeaponKind != ItemKind3.WAND || rightWeaponKind != ItemKind3.STAFF; break; case ItemKind3.YOBO: playerHasCorrectWeapon = !rightWeaponKind.HasValue || rightWeaponKind != ItemKind3.YOYO || rightWeaponKind != ItemKind3.BOW; break; case ItemKind3.SHIELD: Item leftWeapon = player.Inventory.GetEquipedItem(ItemPartType.LeftWeapon); playerHasCorrectWeapon = leftWeapon == null || leftWeapon.Data?.ItemKind3 != ItemKind3.SHIELD; break; default: playerHasCorrectWeapon = skill.Data.LinkKind != rightWeaponKind; break; } if (!playerHasCorrectWeapon) { _textPacketFactory.SendDefinedText(player, DefineText.TID_GAME_WRONGITEM); return(false); } } if (skill.Data.Handed.HasValue) { // TODO: handle dual weapons and two handed weapons } if (skill.Data.BulletLinkKind.HasValue) { Item bulletItem = player.Inventory.GetEquipedItem(ItemPartType.Bullet); if (bulletItem.Id == -1 || bulletItem.Data.ItemKind2 != skill.Data.BulletLinkKind) { DefineText errorText = skill.Data.LinkKind == ItemKind3.BOW ? DefineText.TID_TIP_NEEDSATTACKITEM : DefineText.TID_TIP_NEEDSKILLITEM; _textPacketFactory.SendDefinedText(player, errorText); return(false); } } // TODO: more skill checks return(true); }
public override void defineText(DefineText tag) { open(tag); out_Renamed.Write(" id='" + id(tag) + "'"); out_Renamed.Write(" bounds='" + tag.bounds + "'"); out_Renamed.Write(" matrix='" + tag.matrix + "'"); end(); System.Collections.IEnumerator it = tag.records.GetEnumerator(); //UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratorhasNext'" while (it.MoveNext()) { //UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratornext'" TextRecord tr = (TextRecord) it.Current; printTextRecord(tr, tag.code); } close(tag); }
public virtual void defineText2(DefineText tag) { }