public void TestStatInfoSerialization() { var expectedStatInfo = new StatInfo { Stat = Stat.S3Bet, Caption = "Caption1", IsCaptionHidden = true, DigitsAfterDecimalPoint = 2, CurrentColor = Colors.Black, CurrentValue = 15m, SettingsAppearance_IsChecked = true, SettingsPlayerType_IsChecked = true, SettingsAppearanceFontSource = "Font", SettingsAppearanceFontSize = 15, SettingsAppearanceFontBold_IsChecked = true, SettingsAppearanceFontItalic_IsChecked = true, SettingsAppearanceFontUnderline_IsChecked = true, SettingsAppearanceValueRangeCollection = new ObservableCollection <StatInfoOptionValueRange>() { new StatInfoOptionValueRange() }, MinSample = 15, Label = "Label1", IsNotVisible = true, IsListed = true, StatDto = new StatDto(1, 10), StatInfoMeter = new StatInfoMeterModel(), GraphToolIconSource = "GraphTool" }; var actualStatInfo = SerializerHelper.GetSerializedDeserializedObject(expectedStatInfo); Assert.Multiple(() => { Assert.That(actualStatInfo.Id, Is.EqualTo(expectedStatInfo.Id), nameof(StatInfo.Id)); Assert.That(actualStatInfo.Stat, Is.EqualTo(expectedStatInfo.Stat), nameof(StatInfo.Stat)); Assert.That(actualStatInfo.Caption, Is.EqualTo(expectedStatInfo.Caption), nameof(StatInfo.Caption)); Assert.That(actualStatInfo.IsCaptionHidden, Is.EqualTo(expectedStatInfo.IsCaptionHidden), nameof(StatInfo.IsCaptionHidden)); Assert.That(actualStatInfo.DigitsAfterDecimalPoint, Is.EqualTo(expectedStatInfo.DigitsAfterDecimalPoint), nameof(StatInfo.DigitsAfterDecimalPoint)); Assert.That(actualStatInfo.CurrentColor, Is.EqualTo(expectedStatInfo.CurrentColor), nameof(StatInfo.CurrentColor)); Assert.That(actualStatInfo.CurrentValue, Is.EqualTo(expectedStatInfo.CurrentValue), nameof(StatInfo.CurrentValue)); Assert.That(actualStatInfo.SettingsAppearance_IsChecked, Is.EqualTo(expectedStatInfo.SettingsAppearance_IsChecked), nameof(StatInfo.SettingsAppearance_IsChecked)); Assert.That(actualStatInfo.SettingsPlayerType_IsChecked, Is.EqualTo(expectedStatInfo.SettingsPlayerType_IsChecked), nameof(StatInfo.SettingsPlayerType_IsChecked)); Assert.That(actualStatInfo.SettingsAppearanceFontSource, Is.EqualTo(expectedStatInfo.SettingsAppearanceFontSource), nameof(StatInfo.SettingsAppearanceFontSource)); Assert.That(actualStatInfo.SettingsAppearanceFontSize, Is.EqualTo(expectedStatInfo.SettingsAppearanceFontSize), nameof(StatInfo.SettingsAppearanceFontSize)); Assert.That(actualStatInfo.SettingsAppearanceFontBold_IsChecked, Is.EqualTo(expectedStatInfo.SettingsAppearanceFontBold_IsChecked), nameof(StatInfo.SettingsAppearanceFontBold_IsChecked)); Assert.That(actualStatInfo.SettingsAppearanceFontItalic_IsChecked, Is.EqualTo(expectedStatInfo.SettingsAppearanceFontItalic_IsChecked), nameof(StatInfo.SettingsAppearanceFontItalic_IsChecked)); Assert.That(actualStatInfo.SettingsAppearanceFontUnderline_IsChecked, Is.EqualTo(expectedStatInfo.SettingsAppearanceFontUnderline_IsChecked), nameof(StatInfo.SettingsAppearanceFontUnderline_IsChecked)); Assert.That(actualStatInfo.SettingsAppearanceValueRangeCollection.Count, Is.EqualTo(expectedStatInfo.SettingsAppearanceValueRangeCollection.Count), nameof(StatInfo.SettingsAppearanceValueRangeCollection)); Assert.That(actualStatInfo.MinSample, Is.EqualTo(expectedStatInfo.MinSample), nameof(StatInfo.MinSample)); Assert.That(actualStatInfo.Label, Is.EqualTo(expectedStatInfo.Label), nameof(StatInfo.Label)); Assert.That(actualStatInfo.IsNotVisible, Is.EqualTo(expectedStatInfo.IsNotVisible), nameof(StatInfo.IsNotVisible)); Assert.That(actualStatInfo.IsListed, Is.EqualTo(expectedStatInfo.IsListed), nameof(StatInfo.IsListed)); Assert.That(actualStatInfo.StatDto.Occurred, Is.EqualTo(expectedStatInfo.StatDto.Occurred), nameof(StatDto.Occurred)); Assert.That(actualStatInfo.StatDto.CouldOccurred, Is.EqualTo(expectedStatInfo.StatDto.CouldOccurred), nameof(StatDto.CouldOccurred)); CollectionAssert.AreEqual(expectedStatInfo.StatInfoMeter.BackgroundBrush, actualStatInfo.StatInfoMeter.BackgroundBrush, new SolidBrushComparer(), nameof(StatInfoMeterModel.BackgroundBrush)); CollectionAssert.AreEqual(expectedStatInfo.StatInfoMeter.BorderBrush, actualStatInfo.StatInfoMeter.BorderBrush, new SolidBrushComparer(), nameof(StatInfoMeterModel.BorderBrush)); Assert.That(actualStatInfo.GraphToolIconSource, Is.EqualTo(expectedStatInfo.GraphToolIconSource), nameof(StatInfo.GraphToolIconSource)); }); }
public void CalculateStat() { StatBase = new StatInfo(Info.Stat); StatBase.AddRange(Info.StatIncrease, Level); StatGrade = new StatInfo(StatBase); StatGrade.Multiply(GradePercent); StatAdd = new StatInfo(); if (Weapon != null) { Weapon.AddStats(StatAdd); } if (Armor != null) { Armor.AddStats(StatAdd); } foreach (var skill in Skills.Where(s => s.Info.Type == eSkillType.passive || s.Info.Type == eSkillType.passive_etc)) { skill.AddStats(StatAdd, StatGrade, GradePercent); } foreach (var rune in Runes) { rune.Info.Skill.AddStats(StatAdd, StatGrade, Info.AttackType, 1f, rune.StatLevel); } StatTotal = new StatInfo(StatGrade); StatTotal.AddRange(StatAdd); }
public void GoToMenu() { switch (IUButton._clickButton) //проверяем имя кнопки, по которой кликаем { case "myMainMenu": StatInfo.CurrentLevel = 1; //глав. меню break; case "Level-1": StatInfo._nullAllResources(); //обнуление всех прошлых достижений StatInfo.BeginLevel(); MenuLevels.SetActive(false); //скрываем меню уровней HelpMenuLevel.SetActive(true); //высвечиваем Help-подсказку старта игры (на сцене она продублируется с доступной кнопкой Continue) break; case "Level-2": StatInfo.CurrentLevel = 4;//текущая сцена вторая StatInfo._acceptLevelGame = 2; StatInfo.BeginLevel(); MenuLevels.SetActive(false); //скрываем меню уровней Help2scene.SetActive(true); //высвечиваем Help-подсказку 2ур игры break; } Time.timeScale = 1.0F; //ход времени возобновляем SceneManager.LoadSceneAsync(StatInfo.CurrentLevel); }
public static void SetStatValue(this HudElementViewModel hudElement, Stat stat, decimal value) { if (hudElement == null) { return; } if (hudElement.StatInfoCollection == null) { hudElement.StatInfoCollection = new List <StatInfo>(); } var statInfo = hudElement.StatInfoCollection.FirstOrDefault(x => x.Stat == stat); if (statInfo == null) { statInfo = new StatInfo { Stat = stat }; hudElement.StatInfoCollection.Add(statInfo); } statInfo.Caption = string.Format(statInfo.Format, value); statInfo.CurrentValue = value; }
public CreatureStatus(Xml.Status xmlstatus, Creature target, Xml.Castable castable = null, Creature source = null, int duration = -1, int tickFrequency = -1, double intensity = 1.0) { Target = target; XmlStatus = xmlstatus; Start = DateTime.Now; Target = target; Source = source; Duration = duration == -1 ? xmlstatus.Duration : duration; Tick = tickFrequency == -1 ? xmlstatus.Tick : tickFrequency; Intensity = intensity; // Calculate damage/heal effects. Note that a castable MUST be passed here for a status // to have damage effects as the castable itself has fields we need to access // (intensity, etc) in order to do damage calculations. if (castable != null) { var start = CalculateNumericEffects(castable, xmlstatus.Effects.OnApply, source); var tick = CalculateNumericEffects(castable, xmlstatus.Effects.OnTick, source); var end = CalculateNumericEffects(castable, xmlstatus.Effects.OnRemove, source); var expire = CalculateNumericEffects(castable, xmlstatus.Effects.OnExpire, source); OnStartEffect = new SimpleStatusEffect(start.Heal, start.Damage); OnTickEffect = new SimpleStatusEffect(tick.Heal, tick.Damage); OnRemoveEffect = new SimpleStatusEffect(end.Heal, end.Damage); OnExpireEffect = new SimpleStatusEffect(expire.Heal, expire.Damage); BonusModifiers = NumberCruncher.CalculateStatusModifiers(castable, intensity, xmlstatus.Effects.OnApply.StatModifiers, source, target); } }
public StatInfo GetStat(short level, float grade_percent, short enchant) { StatInfo base_stat = new StatInfo(CreatureInfo.Stat); base_stat.AddRange(CreatureInfo.StatIncrease, level); base_stat.Multiply(grade_percent); StatInfo stat = new StatInfo(base_stat); int equip_grade = 0; for (int i = 1; i < CreatureInfoManager.Instance.Grades.Count; ++i) { if (level <= CreatureInfoManager.Instance.Grades[i].level_max) { equip_grade = i - 1; break; } } EquipInfoManager.Instance.AddStats(CreatureInfo.EquipWeaponCategory.Equips[equip_grade], enchant, stat); EquipInfoManager.Instance.AddStats(CreatureInfo.EquipArmorCategory.Equips[equip_grade], enchant, stat); foreach (var skill_info in CreatureInfo.Skills.Where(s => s.Type == eSkillType.passive || s.Type == eSkillType.passive_etc)) { skill_info.AddStats(stat, base_stat, CreatureInfo.AttackType, grade_percent, level); } return(stat); }
protected override void OnAppearing() { Constants.Hero.updateStats(); menuStats = new List <StatInfo>(); StatInfo name = new StatInfo() { Label = "Nazwa Gracza", Info = Constants.Hero.name }; StatInfo hp = new StatInfo() { Label = "HP", Info = Constants.Hero.maxHp.ToString() }; StatInfo mp = new StatInfo() { Label = "MP", Info = Constants.Hero.maxMp.ToString() }; StatInfo lvl = new StatInfo() { Label = "Level", Info = Constants.Hero.lvl.ToString() }; StatInfo str = new StatInfo() { Label = "Siła", Info = Constants.Hero.atk.ToString() }; StatInfo mag = new StatInfo() { Label = "Magia", Info = Constants.Hero.matk.ToString() }; StatInfo def = new StatInfo() { Label = "Obrona", Info = Constants.Hero.def.ToString() }; StatInfo mdef = new StatInfo() { Label = "Obrona Magiczna", Info = Constants.Hero.mdef.ToString() }; StatInfo speed = new StatInfo() { Label = "Szybkość", Info = Constants.Hero.agi.ToString() }; StatInfo luck = new StatInfo() { Label = "Szczęście", Info = Constants.Hero.luck.ToString() }; menuStats.Add(name); menuStats.Add(lvl); menuStats.Add(hp); menuStats.Add(mp); menuStats.Add(str); menuStats.Add(mag); menuStats.Add(def); menuStats.Add(mdef); menuStats.Add(speed); menuStats.Add(luck); HeroStats.ItemsSource = menuStats; }
private static void Print(string header, Dictionary <Type, StatInfo> stats) { string text = header + "\n"; foreach (KeyValuePair <Type, StatInfo> stat in stats) { string text2 = text; object[] obj = new object[7] { text2, stat.Key.ToString(), ",", null, null, null, null }; StatInfo value = stat.Value; obj[3] = value.numOccurrences; obj[4] = ","; StatInfo value2 = stat.Value; obj[5] = value2.numBytes; obj[6] = "\n"; text = string.Concat(obj); } DebugUtil.LogArgs(text); }
public override void OnConnected(EndPoint endPoint) { Console.WriteLine($"OnConnected : {endPoint}"); // 클라이언트가 서버에 접속성공 // DB를 긁어 플레이어 정보를 가져와서 클라에 보내주고.. MyPlayer = ObjectManager.Instance.Add <Player>(); // 플레이어 생성 { MyPlayer.Info.Name = $"Player_{MyPlayer.Info.ObjectId}"; MyPlayer.Info.PosInfo.State = CreatureState.Idle; MyPlayer.Info.PosInfo.MoveDir = MoveDir.Down; // 처음에 쳐다보고 있는 방향 // 초기값이 0인 경우에는 디버깅할때 값 자체가 안떠서 버그처럼 보이는데 버그는 아님. MyPlayer.Info.PosInfo.PosX = 0; MyPlayer.Info.PosInfo.PosY = 0; StatInfo stat = null; DataManager.StatDict.TryGetValue(1, out stat); MyPlayer.Stat.MergeFrom(stat); // stat에 있는 정보를 MyPlayer.Stat에 하나하나 대입 MyPlayer.Session = this; } // 지금 방이 1번방밖에 없다 GameRoom room = RoomManager.Instance.Find(1); room.Push(room.EnterGame, MyPlayer); }
public void Copy(StatInfo source, StatInfo target) { foreach (PropertyInfo field in Fields.Values) { field.SetValue(target, field.GetValue(source, null), null); } }
public void AddRange(StatInfo info, StatInfo source, int multi_value) { foreach (PropertyInfo field in Fields.Values) { field.SetValue(info, (int)field.GetValue(info, null) + (int)field.GetValue(source, null) * multi_value, null); } }
public virtual void Setup() { anim = GetComponent <Animator>(); sRend = GetComponent <SpriteRenderer>(); foreach (Collider2D cols in GetComponentsInChildren <Collider2D>()) { if (cols.gameObject.layer == LayerMask.NameToLayer("Wall")) { wallBox = cols; break; } } stunTimer = 0; anim.SetInteger("state", (int)CharacterState.Still); anim.SetInteger("dir", (int)Dir.Down); oddStep = false; speedFactor = NORMAL_SPEED_FACTOR; stats = new StatInfo(new Dictionary <string, float> { { "health", MAX_HEALTH }, { "attack", attack }, { "defense", defense }, { "speed", speed } }); collisionLayerMask = LayerMask.GetMask("Wall", "Bedrock", "InteractiveBlock"); }
public StatInfo Clone(StatInfo info) { StatInfo new_info = new StatInfo(); Copy(info, new_info); return(new_info); }
public static void GameCharInfo(Packet packet) // TODO: Send data correspoding to the charname, not user { /* * [Debug] - GameCharInfo: 000000: 41 00 64 00 6D 00 69 00 6E 00 69 00 73 00 74 00 A · d · m · i · n · i · s · t · * 000016: 72 00 61 00 74 00 6F 00 72 00 00 00 0A 00 06 00 r · a · t · o · r · · · · · · · * 000032: 0D 25 33 65 63 65 69 76 65 64 00 00 00 00 · % 3 e c e i v e d · · · · * * [Info] - Received GameCharInfo (id 660, 0x294) on 11021. * * Wrong Packet Size. CMD(661) CmdLen: : 1177, AnalysisSize: 831 * // We're missing 346 bytes of data. */ var charName = packet.Reader.ReadUnicodeStatic(21); var ack = new Packet(Packets.GameCharInfoAck); packet.Sender.User.ActiveCharacter.Serialize(ack.Writer); packet.Sender.User.ActiveCar.Serialize(ack.Writer); var sinfo = new StatInfo(); sinfo.Serialize(ack.Writer); packet.Sender.User.ActiveTeam.Serialize(ack.Writer); ack.Writer.Write((uint)0); // Serial ack.Writer.Write('A'); // LocType ack.Writer.Write('A'); // ChId ack.Writer.Write((ushort)1); // LocId packet.Sender.Send(ack); }
public override void OnConnected(EndPoint endPoint) { Console.WriteLine($"OnConnected : {endPoint}"); MyPlayer = ObjectManager.Instance.Add <Player>(); { MyPlayer.Info.Name = $"Player_{MyPlayer.Info.ObjectId}"; MyPlayer.Info.PosInfo.State = CreatureState.Idle; MyPlayer.Info.PosInfo.Movedir = MoveDir.Down; MyPlayer.Info.PosInfo.PosX = 0; MyPlayer.Info.PosInfo.PosY = 0; StatInfo stat = null; DataManager.StatDict.TryGetValue(1, out stat); MyPlayer.Stat.MergeFrom(stat); MyPlayer.Session = this; } GameRoom room = RoomManager.Instance.Find(1); room.Push(room.EnterGame, MyPlayer); //S_Chat chat2 = new S_Chat(); //chat2.MergeFrom(sendBuffer, 4, sendBuffer.Length - 4); ////////////////////////// ////////////////////////// //Program.Room.Push(() => Program.Room.Enter(this)); }
public override void OnConnected(EndPoint endPoint) { Console.WriteLine($"OnConnected : {endPoint}"); { S_Connected connectedPacket = new S_Connected(); Send(connectedPacket); } //TODO : 로비에서 캐릭터 선택 MyPlayer = ObjectManager.Instance.Add <Player>(); { MyPlayer.Info.Name = $"Player_{MyPlayer.Info.ObjectId}"; MyPlayer.Info.PosInfo.State = CreatureState.Idle; MyPlayer.Info.PosInfo.MoveDir = MoveDir.Down; MyPlayer.Info.PosInfo.PosX = 0; MyPlayer.Info.PosInfo.PosY = 0; StatInfo stat = null; DataManager.StatDict.TryGetValue(1, out stat); MyPlayer.Stat.MergeFrom(stat); MyPlayer.Session = this; } //TODO : 입장 요청 들어오면 실행 GameRoom room = RoomManager.Instance.Find(1); room.Push(room.EnterGame, MyPlayer); }
public CreatureStat(StatInfo base_stat) { this.Base = base_stat; CalculateStat(null); HP = MaxHP = Stat.MaxHP; MP = Stat.ManaInit; }
private StatInfo GenerateStatInfo(Resource resource) { StatInfo instance = Instantiate(ResourceEarningMultiplierInfo); instance.Identifier = resource.Identifier + "EarningsMultiplier"; instance.Name = resource.Name + " Earnings Multiplier"; return(instance); }
public string Tooltip(int enchant) { StatInfo stat = new StatInfo(); EquipInfoManager.Instance.AddStats(this, enchant, stat); return(stat.Tooltip(CategoryInfo.AttackType)); }
public void SetValue(StatInfo info, eStatType type, int value) { PropertyInfo field; if (Fields.TryGetValue(type, out field)) { field.SetValue(info, value, null); } }
public ProfileStatRank(StatInfo s, float val, Profile pro = null) { if (pro != null) { this.profiles.Add(pro); } this.value = val; this.stat = s; }
private static StatInfo LoadSingleStat(IDataReader reader) { StatInfo statinfo = new StatInfo(); statinfo.Type = reader["type"].ToString().Trim(); statinfo.Variable = reader["variable"].ToString().Trim(); statinfo.Count = TypeConverter.ObjectToInt(reader["count"], 0); return(statinfo); }
public override void Load(Hashtable wsd) { Setup(); base.Load(wsd); if (wsd.ContainsKey("statLevels")) { stats = new StatInfo((Dictionary <string, float>)wsd["statLevels"]); } }
//#STAT ALLOCATOR public void buffPlayer(string playerName, int value, e_StatType statType) { StatInfo statInfo = new StatInfo(); statInfo.value = value; statInfo.statType = statType; statInfo.playerName = playerName; con.Send(PacketTypes.PLAYER_BUFF, statInfo); }
public int GetValue(StatInfo info, eStatType type) { PropertyInfo field; if (Fields.TryGetValue(type, out field)) { return((int)field.GetValue(info, null)); } return(0); }
public void AddValue(StatInfo info, eStatType type, int add_value) { PropertyInfo field; if (Fields.TryGetValue(type, out field)) { int value = (int)field.GetValue(info, null); field.SetValue(info, Math.Max(0, value + add_value), null); } }
private void Menu_AddStat_Click(object sender, System.EventArgs e) { StatInfo info = new StatInfo(); TreeNode node = new TreeNode(info.ToString()); node.Tag = info; this.C_GroupInfoTree.Nodes.Add(node); }
public string GetTooltip() { StatInfo stat = new StatInfo(); EquipInfoManager.Instance.AddStats(Info, EnchantLevel, stat); if (EnchantLevel > 0) { return(Localization.Format("EquipTooltipEnchantLevel", Info.Name, EnchantLevel) + stat.Tooltip(Info.CategoryInfo.AttackType)); } return(Localization.Format("EquipTooltip", Info.Name) + stat.Tooltip(Info.CategoryInfo.AttackType)); }
private void btn_date_Click(object sender, EventArgs e) { DateTime startDate; DateTime endDate; startDate = RentDatePicker.Show("Виберіть початкову дату.", "Вибір дати", new DateTime(), DateTime.Now.AddDays(1)); endDate = RentDatePicker.Show("Виберіть кінцеву дату.", "Вибір дати", new DateTime(), DateTime.Now.AddDays(1)); stat_Custom = mainWindow.serverData.client.SendStatInfo(startDate, endDate); setStatObject(stat_Custom); }
private void OnValidate() { Text[] texts = GetComponentsInChildren <Text>(); nameText = texts[0]; valueText = texts[1]; if (statInfo == null) { statInfo = FindObjectOfType <StatInfo>(); } }
private void UpdateStatistics() { StatsData = ApplicationModel.Database.Value.Statistics; Statistics.Clear(); ViewOptions.Clear(); ViewOptions.Add("All"); ViewOptions.Add("Single Items"); if (StatsData.Value == null) { if (retries-- == 0) { ApplicationModel.Current.Notifications.Add(new Notification("Could not load settings for database " + ApplicationModel.Database.Value.Name)); return; } Thread.Sleep(100); UpdateStatistics(); return; } retries = 3; foreach (var propertyInfo in StatsData.Value.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public)) { var enumerable = propertyInfo.GetValue(StatsData.Value, null) as IEnumerable<object>; if (enumerable != null) { var list = enumerable as List<object> ?? enumerable.ToList(); if (propertyInfo.Name == "StaleIndexes") { StaleIndexes = new List<object>(list); if (list.Count == 0) { Statistics.Add(propertyInfo.Name, new StatInfo { Message = "No Stale Indexes", ToolTipData = "No Stale Indexes" }); } else if (list.Count > 1) { ViewOptions.Add("Stale Indexes"); Statistics.Add(propertyInfo.Name, new StatInfo { Message = string.Format("There are {0} Stale Indexes: {1}", list.Count, string.Join(",", list)), ToolTipData = string.Join(", ", list) }); } else // only one item { ViewOptions.Add("Stale Indexes"); Statistics.Add(propertyInfo.Name, new StatInfo { Message = "There is 1 Stale Index: " + list[0], ToolTipData = list[0].ToString() // only one item, no need to call string.Join() }); } continue; } if (list.Count == 0) { continue; } if ((list.First() is string == false) && (list.First() is Abstractions.Data.IndexStats == false)) continue; var statInfo = new StatInfo { IsList = true, ListItems = new List<StatInfoItem>(), }; foreach (var item in list) { var statInfoItem = new StatInfoItem(item); if (statInfoItem.ItemType == typeof(Abstractions.Data.IndexStats)) AddIndexStat(statInfoItem); statInfo.ListItems.Add(statInfoItem); } Statistics.Add(propertyInfo.Name, statInfo); ViewOptions.Add(propertyInfo.Name); } else { if (string.IsNullOrEmpty(propertyInfo.GetValue(StatsData.Value, null).ToString()) || propertyInfo.GetValue(StatsData.Value, null).ToString() == "0") continue; Statistics.Add(propertyInfo.Name, new StatInfo { Message = GetValueWithFormat(propertyInfo.GetValue(StatsData.Value, null)), ToolTipData = GetValueWithFormat(propertyInfo.GetValue(StatsData.Value, null)) }); } } OnPropertyChanged(() => StatsData); UpdateView(); }