From eb1ddc27c3f1c27d3667dc8aa65a35914080504b Mon Sep 17 00:00:00 2001 From: lotuuu Date: Tue, 11 Jun 2024 17:57:04 -0300 Subject: [PATCH 1/4] Add UnitRewards and ItemRewards --- client/Assets/Scenes/Overworld.unity | 2 +- .../BackendConnection/SocketConnection.cs | 12 +- client/Assets/Scripts/Battle/BattleManager.cs | 17 +- client/Assets/Scripts/Campaign/ItemReward.cs | 8 + .../Scripts/Campaign/ItemReward.cs.meta | 11 + client/Assets/Scripts/Campaign/LevelData.cs | 9 +- client/Assets/Scripts/Campaign/UnitReward.cs | 8 + .../Scripts/Campaign/UnitReward.cs.meta | 11 + client/Assets/Scripts/Protobuf/Gateway.pb.cs | 737 ++++++++++++++++-- client/Assets/Scripts/Shared/UIReward.cs | 40 +- gateway.proto | 16 +- 11 files changed, 772 insertions(+), 99 deletions(-) create mode 100644 client/Assets/Scripts/Campaign/ItemReward.cs create mode 100644 client/Assets/Scripts/Campaign/ItemReward.cs.meta create mode 100644 client/Assets/Scripts/Campaign/UnitReward.cs create mode 100644 client/Assets/Scripts/Campaign/UnitReward.cs.meta diff --git a/client/Assets/Scenes/Overworld.unity b/client/Assets/Scenes/Overworld.unity index bb34b2a0..af77fa76 100644 --- a/client/Assets/Scenes/Overworld.unity +++ b/client/Assets/Scenes/Overworld.unity @@ -38,7 +38,7 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 0} - m_IndirectSpecularColor: {r: 0.3708708, g: 0.37838137, b: 0.35725543, a: 1} + m_IndirectSpecularColor: {r: 0.3710032, g: 0.3785125, b: 0.35738343, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: diff --git a/client/Assets/Scripts/BackendConnection/SocketConnection.cs b/client/Assets/Scripts/BackendConnection/SocketConnection.cs index bf10f3f3..d0aed184 100644 --- a/client/Assets/Scripts/BackendConnection/SocketConnection.cs +++ b/client/Assets/Scripts/BackendConnection/SocketConnection.cs @@ -270,7 +270,17 @@ private List ParseCampaignsFromResponse(Protobuf.Messages.Campaigns ca levelNumber = (int)level.LevelNumber, campaignId = level.CampaignId, units = levelUnits, - rewards = GetLevelCurrencyRewards(level), + currencyRewards = GetLevelCurrencyRewards(level), + itemRewards = level.ItemRewards.Select(itemReward => new ItemReward + { + itemTemplate = GlobalUserData.Instance.AvailableItemTemplates.Find(itemTemplate => itemTemplate.name.ToLower() == itemReward.ItemTemplateName.ToLower()), + level = (int)itemReward.Level + }).ToList(), + unitRewards = level.UnitRewards.Select(unitReward => new UnitReward + { + character = availableCharacters.Find(character => character.name.ToLower() == unitReward.CharacterName.ToLower()), + rank = (int)unitReward.Rank + }).ToList(), status = levelStatus }); diff --git a/client/Assets/Scripts/Battle/BattleManager.cs b/client/Assets/Scripts/Battle/BattleManager.cs index f2bf1e5d..99496812 100644 --- a/client/Assets/Scripts/Battle/BattleManager.cs +++ b/client/Assets/Scripts/Battle/BattleManager.cs @@ -212,8 +212,6 @@ private void HandleBattleResult(bool result) } GlobalUserData user = GlobalUserData.Instance; user.AddCurrencies(GetLevelRewards()); - user.User.afkMaxCurrencyReward = LevelProgress.selectedLevelData.afkCurrencyRate; - user.User.afkMaxExperienceReward = LevelProgress.selectedLevelData.afkExperienceRate; victorySplash.GetComponentInChildren().Populate(CreateRewardsList()); victorySplash.SetActive(true); victorySplash.GetComponent().Play(); @@ -307,7 +305,7 @@ private void ProcessExecutionsReceived(IEnumerable act private Dictionary GetLevelRewards() { - Dictionary rewards = LevelProgress.selectedLevelData.rewards; + Dictionary rewards = LevelProgress.selectedLevelData.currencyRewards; if (LevelProgress.selectedLevelData.experienceReward > 0) { rewards.Add("Experience", LevelProgress.selectedLevelData.experienceReward); @@ -337,13 +335,24 @@ private List CreateRewardsList() { List rewards = new List(); - foreach (var currencyReward in LevelProgress.selectedLevelData.rewards) + foreach (var currencyReward in LevelProgress.selectedLevelData.currencyRewards) { if (currencyReward.Value > 0) { rewards.Add(new CurrencyUIReward(currencyReward.Key, currencyReward.Value)); } } + + foreach (var unitReward in LevelProgress.selectedLevelData.unitRewards) + { + rewards.Add(new UnitUIReward(unitReward)); + } + + foreach (var itemReward in LevelProgress.selectedLevelData.itemRewards) + { + rewards.Add(new ItemUIReward(itemReward)); + } + return rewards; } diff --git a/client/Assets/Scripts/Campaign/ItemReward.cs b/client/Assets/Scripts/Campaign/ItemReward.cs new file mode 100644 index 00000000..4b607ed6 --- /dev/null +++ b/client/Assets/Scripts/Campaign/ItemReward.cs @@ -0,0 +1,8 @@ +using System.Collections; +using System.Collections.Generic; + +public class ItemReward +{ + public ItemTemplate itemTemplate; + public int level; +} diff --git a/client/Assets/Scripts/Campaign/ItemReward.cs.meta b/client/Assets/Scripts/Campaign/ItemReward.cs.meta new file mode 100644 index 00000000..3f8f20d3 --- /dev/null +++ b/client/Assets/Scripts/Campaign/ItemReward.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5970288271232487699b5c332eb142a7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/client/Assets/Scripts/Campaign/LevelData.cs b/client/Assets/Scripts/Campaign/LevelData.cs index ac23f794..35684945 100644 --- a/client/Assets/Scripts/Campaign/LevelData.cs +++ b/client/Assets/Scripts/Campaign/LevelData.cs @@ -9,13 +9,10 @@ public class LevelData public string campaignId; public List units; - public Dictionary rewards = new Dictionary(); + public Dictionary currencyRewards = new Dictionary(); - // AFK Rewards daily_rate granted - // These are how many a player makes in the maximum timespan available (12h now) - public Dictionary afkCurrencyRate = new Dictionary(); - - public int afkExperienceRate; + public List itemRewards = new(); + public List unitRewards = new(); public int experienceReward; diff --git a/client/Assets/Scripts/Campaign/UnitReward.cs b/client/Assets/Scripts/Campaign/UnitReward.cs new file mode 100644 index 00000000..4d216e65 --- /dev/null +++ b/client/Assets/Scripts/Campaign/UnitReward.cs @@ -0,0 +1,8 @@ +using System.Collections; +using System.Collections.Generic; + +public class UnitReward +{ + public Character character; + public int rank; +} diff --git a/client/Assets/Scripts/Campaign/UnitReward.cs.meta b/client/Assets/Scripts/Campaign/UnitReward.cs.meta new file mode 100644 index 00000000..bedfeee0 --- /dev/null +++ b/client/Assets/Scripts/Campaign/UnitReward.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2485f214e0a8e464492cba2c742cb448 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/client/Assets/Scripts/Protobuf/Gateway.pb.cs b/client/Assets/Scripts/Protobuf/Gateway.pb.cs index cb0025f4..59688e03 100644 --- a/client/Assets/Scripts/Protobuf/Gateway.pb.cs +++ b/client/Assets/Scripts/Protobuf/Gateway.pb.cs @@ -122,58 +122,64 @@ static GatewayReflection() { "YWlnbnMSHAoJY2FtcGFpZ25zGAEgAygLMgkuQ2FtcGFpZ24iZAoIQ2FtcGFp", "Z24SCgoCaWQYASABKAkSGwoTc3VwZXJfY2FtcGFpZ25fbmFtZRgCIAEoCRIX", "Cg9jYW1wYWlnbl9udW1iZXIYAyABKA0SFgoGbGV2ZWxzGAQgAygLMgYuTGV2", - "ZWwimgEKBUxldmVsEgoKAmlkGAEgASgJEhMKC2NhbXBhaWduX2lkGAIgASgJ", + "ZWwimAIKBUxldmVsEgoKAmlkGAEgASgJEhMKC2NhbXBhaWduX2lkGAIgASgJ", "EhQKDGxldmVsX251bWJlchgDIAEoDRIUCgV1bml0cxgEIAMoCzIFLlVuaXQS", - "KQoQY3VycmVuY3lfcmV3YXJkcxgFIAMoCzIPLkN1cnJlbmN5UmV3YXJkEhkK", - "EWV4cGVyaWVuY2VfcmV3YXJkGAYgASgNIj0KDkN1cnJlbmN5UmV3YXJkEhsK", - "CGN1cnJlbmN5GAEgASgLMgkuQ3VycmVuY3kSDgoGYW1vdW50GAMgASgEIi0K", - "CkFma1Jld2FyZHM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KB0RFRkVOU0UQAxIUChBEQU1BR0Vf", + "UkVEVUNUSU9OEAQSCQoFU1BFRUQQBUIUqgIRUHJvdG9idWYuTWVzc2FnZXNi", + "BnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Protobuf.Messages.SkillActionType), typeof(global::Protobuf.Messages.Stat), }, null, new pbr::GeneratedClrTypeInfo[] { @@ -220,8 +226,10 @@ static GatewayReflection() { new pbr::GeneratedClrTypeInfo(typeof(global::Protobuf.Messages.ItemTemplate), global::Protobuf.Messages.ItemTemplate.Parser, new[]{ "Id", "Name", "Type" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Protobuf.Messages.Campaigns), global::Protobuf.Messages.Campaigns.Parser, new[]{ "Campaigns_" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Protobuf.Messages.Campaign), global::Protobuf.Messages.Campaign.Parser, new[]{ "Id", "SuperCampaignName", "CampaignNumber", "Levels" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Protobuf.Messages.Level), global::Protobuf.Messages.Level.Parser, new[]{ "Id", "CampaignId", "LevelNumber", "Units", "CurrencyRewards", "ExperienceReward" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Protobuf.Messages.Level), global::Protobuf.Messages.Level.Parser, new[]{ "Id", "CampaignId", "LevelNumber", "Units", "CurrencyRewards", "ItemRewards", "UnitRewards", "ExperienceReward", "AttemptCost", "MaxUnits" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Protobuf.Messages.CurrencyReward), global::Protobuf.Messages.CurrencyReward.Parser, new[]{ "Currency", "Amount" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Protobuf.Messages.ItemReward), global::Protobuf.Messages.ItemReward.Parser, new[]{ "ItemTemplateName", "Level" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Protobuf.Messages.UnitReward), global::Protobuf.Messages.UnitReward.Parser, new[]{ "CharacterName", "Rank" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Protobuf.Messages.AfkRewards), global::Protobuf.Messages.AfkRewards.Parser, new[]{ "AfkRewards_" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Protobuf.Messages.AfkReward), global::Protobuf.Messages.AfkReward.Parser, new[]{ "Currency", "Amount" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Protobuf.Messages.Error), global::Protobuf.Messages.Error.Parser, new[]{ "Reason" }, null, null, null, null), @@ -12820,7 +12828,11 @@ public Level(Level other) : this() { levelNumber_ = other.levelNumber_; units_ = other.units_.Clone(); currencyRewards_ = other.currencyRewards_.Clone(); + itemRewards_ = other.itemRewards_.Clone(); + unitRewards_ = other.unitRewards_.Clone(); experienceReward_ = other.experienceReward_; + attemptCost_ = other.attemptCost_.Clone(); + maxUnits_ = other.maxUnits_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -12888,8 +12900,30 @@ public uint LevelNumber { get { return currencyRewards_; } } + /// Field number for the "item_rewards" field. + public const int ItemRewardsFieldNumber = 6; + private static readonly pb::FieldCodec _repeated_itemRewards_codec + = pb::FieldCodec.ForMessage(50, global::Protobuf.Messages.ItemReward.Parser); + private readonly pbc::RepeatedField itemRewards_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField ItemRewards { + get { return itemRewards_; } + } + + /// Field number for the "unit_rewards" field. + public const int UnitRewardsFieldNumber = 7; + private static readonly pb::FieldCodec _repeated_unitRewards_codec + = pb::FieldCodec.ForMessage(58, global::Protobuf.Messages.UnitReward.Parser); + private readonly pbc::RepeatedField unitRewards_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField UnitRewards { + get { return unitRewards_; } + } + /// Field number for the "experience_reward" field. - public const int ExperienceRewardFieldNumber = 6; + public const int ExperienceRewardFieldNumber = 9; private uint experienceReward_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] @@ -12900,6 +12934,29 @@ public uint ExperienceReward { } } + /// Field number for the "attempt_cost" field. + public const int AttemptCostFieldNumber = 10; + private static readonly pb::FieldCodec _repeated_attemptCost_codec + = pb::FieldCodec.ForMessage(82, global::Protobuf.Messages.CurrencyCost.Parser); + private readonly pbc::RepeatedField attemptCost_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField AttemptCost { + get { return attemptCost_; } + } + + /// Field number for the "max_units" field. + public const int MaxUnitsFieldNumber = 8; + private uint maxUnits_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public uint MaxUnits { + get { return maxUnits_; } + set { + maxUnits_ = value; + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { @@ -12920,7 +12977,11 @@ public bool Equals(Level other) { if (LevelNumber != other.LevelNumber) return false; if(!units_.Equals(other.units_)) return false; if(!currencyRewards_.Equals(other.currencyRewards_)) return false; + if(!itemRewards_.Equals(other.itemRewards_)) return false; + if(!unitRewards_.Equals(other.unitRewards_)) return false; if (ExperienceReward != other.ExperienceReward) return false; + if(!attemptCost_.Equals(other.attemptCost_)) return false; + if (MaxUnits != other.MaxUnits) return false; return Equals(_unknownFields, other._unknownFields); } @@ -12933,7 +12994,11 @@ public override int GetHashCode() { if (LevelNumber != 0) hash ^= LevelNumber.GetHashCode(); hash ^= units_.GetHashCode(); hash ^= currencyRewards_.GetHashCode(); + hash ^= itemRewards_.GetHashCode(); + hash ^= unitRewards_.GetHashCode(); if (ExperienceReward != 0) hash ^= ExperienceReward.GetHashCode(); + hash ^= attemptCost_.GetHashCode(); + if (MaxUnits != 0) hash ^= MaxUnits.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -12966,10 +13031,17 @@ public void WriteTo(pb::CodedOutputStream output) { } units_.WriteTo(output, _repeated_units_codec); currencyRewards_.WriteTo(output, _repeated_currencyRewards_codec); + itemRewards_.WriteTo(output, _repeated_itemRewards_codec); + unitRewards_.WriteTo(output, _repeated_unitRewards_codec); + if (MaxUnits != 0) { + output.WriteRawTag(64); + output.WriteUInt32(MaxUnits); + } if (ExperienceReward != 0) { - output.WriteRawTag(48); + output.WriteRawTag(72); output.WriteUInt32(ExperienceReward); } + attemptCost_.WriteTo(output, _repeated_attemptCost_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -12994,10 +13066,17 @@ public void WriteTo(pb::CodedOutputStream output) { } units_.WriteTo(ref output, _repeated_units_codec); currencyRewards_.WriteTo(ref output, _repeated_currencyRewards_codec); + itemRewards_.WriteTo(ref output, _repeated_itemRewards_codec); + unitRewards_.WriteTo(ref output, _repeated_unitRewards_codec); + if (MaxUnits != 0) { + output.WriteRawTag(64); + output.WriteUInt32(MaxUnits); + } if (ExperienceReward != 0) { - output.WriteRawTag(48); + output.WriteRawTag(72); output.WriteUInt32(ExperienceReward); } + attemptCost_.WriteTo(ref output, _repeated_attemptCost_codec); if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } @@ -13019,9 +13098,15 @@ public int CalculateSize() { } size += units_.CalculateSize(_repeated_units_codec); size += currencyRewards_.CalculateSize(_repeated_currencyRewards_codec); + size += itemRewards_.CalculateSize(_repeated_itemRewards_codec); + size += unitRewards_.CalculateSize(_repeated_unitRewards_codec); if (ExperienceReward != 0) { size += 1 + pb::CodedOutputStream.ComputeUInt32Size(ExperienceReward); } + size += attemptCost_.CalculateSize(_repeated_attemptCost_codec); + if (MaxUnits != 0) { + size += 1 + pb::CodedOutputStream.ComputeUInt32Size(MaxUnits); + } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -13045,9 +13130,15 @@ public void MergeFrom(Level other) { } units_.Add(other.units_); currencyRewards_.Add(other.currencyRewards_); + itemRewards_.Add(other.itemRewards_); + unitRewards_.Add(other.unitRewards_); if (other.ExperienceReward != 0) { ExperienceReward = other.ExperienceReward; } + attemptCost_.Add(other.attemptCost_); + if (other.MaxUnits != 0) { + MaxUnits = other.MaxUnits; + } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -13083,10 +13174,26 @@ public void MergeFrom(pb::CodedInputStream input) { currencyRewards_.AddEntriesFrom(input, _repeated_currencyRewards_codec); break; } - case 48: { + case 50: { + itemRewards_.AddEntriesFrom(input, _repeated_itemRewards_codec); + break; + } + case 58: { + unitRewards_.AddEntriesFrom(input, _repeated_unitRewards_codec); + break; + } + case 64: { + MaxUnits = input.ReadUInt32(); + break; + } + case 72: { ExperienceReward = input.ReadUInt32(); break; } + case 82: { + attemptCost_.AddEntriesFrom(input, _repeated_attemptCost_codec); + break; + } } } #endif @@ -13122,10 +13229,26 @@ public void MergeFrom(pb::CodedInputStream input) { currencyRewards_.AddEntriesFrom(ref input, _repeated_currencyRewards_codec); break; } - case 48: { + case 50: { + itemRewards_.AddEntriesFrom(ref input, _repeated_itemRewards_codec); + break; + } + case 58: { + unitRewards_.AddEntriesFrom(ref input, _repeated_unitRewards_codec); + break; + } + case 64: { + MaxUnits = input.ReadUInt32(); + break; + } + case 72: { ExperienceReward = input.ReadUInt32(); break; } + case 82: { + attemptCost_.AddEntriesFrom(ref input, _repeated_attemptCost_codec); + break; + } } } } @@ -13369,6 +13492,460 @@ public void MergeFrom(pb::CodedInputStream input) { } + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class ItemReward : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ItemReward()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[45]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ItemReward() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ItemReward(ItemReward other) : this() { + itemTemplateName_ = other.itemTemplateName_; + level_ = other.level_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ItemReward Clone() { + return new ItemReward(this); + } + + /// Field number for the "item_template_name" field. + public const int ItemTemplateNameFieldNumber = 1; + private string itemTemplateName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string ItemTemplateName { + get { return itemTemplateName_; } + set { + itemTemplateName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "level" field. + public const int LevelFieldNumber = 2; + private uint level_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public uint Level { + get { return level_; } + set { + level_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ItemReward); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ItemReward other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (ItemTemplateName != other.ItemTemplateName) return false; + if (Level != other.Level) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (ItemTemplateName.Length != 0) hash ^= ItemTemplateName.GetHashCode(); + if (Level != 0) hash ^= Level.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (ItemTemplateName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(ItemTemplateName); + } + if (Level != 0) { + output.WriteRawTag(16); + output.WriteUInt32(Level); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (ItemTemplateName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(ItemTemplateName); + } + if (Level != 0) { + output.WriteRawTag(16); + output.WriteUInt32(Level); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (ItemTemplateName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ItemTemplateName); + } + if (Level != 0) { + size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Level); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ItemReward other) { + if (other == null) { + return; + } + if (other.ItemTemplateName.Length != 0) { + ItemTemplateName = other.ItemTemplateName; + } + if (other.Level != 0) { + Level = other.Level; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + ItemTemplateName = input.ReadString(); + break; + } + case 16: { + Level = input.ReadUInt32(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + ItemTemplateName = input.ReadString(); + break; + } + case 16: { + Level = input.ReadUInt32(); + break; + } + } + } + } + #endif + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class UnitReward : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new UnitReward()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[46]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public UnitReward() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public UnitReward(UnitReward other) : this() { + characterName_ = other.characterName_; + rank_ = other.rank_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public UnitReward Clone() { + return new UnitReward(this); + } + + /// Field number for the "character_name" field. + public const int CharacterNameFieldNumber = 1; + private string characterName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string CharacterName { + get { return characterName_; } + set { + characterName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "rank" field. + public const int RankFieldNumber = 4; + private uint rank_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public uint Rank { + get { return rank_; } + set { + rank_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as UnitReward); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(UnitReward other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (CharacterName != other.CharacterName) return false; + if (Rank != other.Rank) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (CharacterName.Length != 0) hash ^= CharacterName.GetHashCode(); + if (Rank != 0) hash ^= Rank.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (CharacterName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(CharacterName); + } + if (Rank != 0) { + output.WriteRawTag(32); + output.WriteUInt32(Rank); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (CharacterName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(CharacterName); + } + if (Rank != 0) { + output.WriteRawTag(32); + output.WriteUInt32(Rank); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (CharacterName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(CharacterName); + } + if (Rank != 0) { + size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Rank); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(UnitReward other) { + if (other == null) { + return; + } + if (other.CharacterName.Length != 0) { + CharacterName = other.CharacterName; + } + if (other.Rank != 0) { + Rank = other.Rank; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + CharacterName = input.ReadString(); + break; + } + case 32: { + Rank = input.ReadUInt32(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + CharacterName = input.ReadString(); + break; + } + case 32: { + Rank = input.ReadUInt32(); + break; + } + } + } + } + #endif + + } + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] public sealed partial class AfkRewards : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE @@ -13384,7 +13961,7 @@ public sealed partial class AfkRewards : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[45]; } + get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[47]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -13563,7 +14140,7 @@ public sealed partial class AfkReward : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[46]; } + get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[48]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -13799,7 +14376,7 @@ public sealed partial class Error : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[47]; } + get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[49]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -13989,7 +14566,7 @@ public sealed partial class Boxes : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[48]; } + get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[50]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -14168,7 +14745,7 @@ public sealed partial class Box : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[49]; } + get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[51]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -14510,7 +15087,7 @@ public sealed partial class RankWeights : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[50]; } + get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[52]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -14737,7 +15314,7 @@ public sealed partial class CurrencyCost : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[51]; } + get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[53]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -14973,7 +15550,7 @@ public sealed partial class UserAndUnit : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[52]; } + get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[54]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -15218,7 +15795,7 @@ public sealed partial class BattleResult : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[53]; } + get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[55]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -15480,7 +16057,7 @@ public sealed partial class State : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[54]; } + get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[56]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -15659,7 +16236,7 @@ public sealed partial class BattleUnit : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[55]; } + get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[57]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -16034,7 +16611,7 @@ public sealed partial class Step : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[56]; } + get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[58]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -16250,7 +16827,7 @@ public sealed partial class Action : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[57]; } + get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[59]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -16907,7 +17484,7 @@ public sealed partial class StatAffected : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[58]; } + get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[60]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -17134,7 +17711,7 @@ public sealed partial class SkillAction : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[59]; } + get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[61]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -17424,7 +18001,7 @@ public sealed partial class ExecutionReceived : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[60]; } + get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[62]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -17660,7 +18237,7 @@ public sealed partial class ModifierReceived : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[61]; } + get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[63]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -17970,7 +18547,7 @@ public sealed partial class TagReceived : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[62]; } + get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[64]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -18234,7 +18811,7 @@ public sealed partial class ModifierExpired : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[63]; } + get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[65]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -18544,7 +19121,7 @@ public sealed partial class TagExpired : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[64]; } + get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[66]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -18808,7 +19385,7 @@ public sealed partial class Death : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[65]; } + get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[67]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -18998,7 +19575,7 @@ public sealed partial class EnergyRegen : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[66]; } + get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[68]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -19262,7 +19839,7 @@ public sealed partial class StatOverride : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[67]; } + get { return global::Protobuf.Messages.GatewayReflection.Descriptor.MessageTypes[69]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] diff --git a/client/Assets/Scripts/Shared/UIReward.cs b/client/Assets/Scripts/Shared/UIReward.cs index bf271c94..f42a0177 100644 --- a/client/Assets/Scripts/Shared/UIReward.cs +++ b/client/Assets/Scripts/Shared/UIReward.cs @@ -5,7 +5,14 @@ public abstract class UIReward { public Sprite Sprite() { - return GlobalUserData.Instance.AvailableCurrencies.Single(currency => currency.name == RewardType()).image; + return RewardType() switch + { + "experience" => GlobalUserData.Instance.AvailableCurrencies.Single(currency => currency.name == "experience").image, + "item" => ((ItemUIReward)this).itemReward.itemTemplate.icon, + "unit" => ((UnitUIReward)this).unitReward.character.defaultSprite, + // If it's not any of the other 3, then it's a Currency + _ => GlobalUserData.Instance.AvailableCurrencies.Single(currency => currency.name == RewardType()).image + }; } public abstract int Amount(); @@ -42,8 +49,29 @@ public ExperienceUIReward(int amount) public override string RewardType() { return "experience"; } } -//// When we implement item rewards: -// public class ItemUIReward : UIReward { -// public Item item; -// public int amount; -// } +public class ItemUIReward : UIReward +{ + public ItemReward itemReward; + + public ItemUIReward(ItemReward itemReward) + { + this.itemReward = itemReward; + } + + public override int Amount() { return 1; } + + public override string RewardType() { return "item"; } +} + +public class UnitUIReward : UIReward +{ + public UnitReward unitReward; + public UnitUIReward(UnitReward unitReward) + { + this.unitReward = unitReward; + } + + public override int Amount() { return 1; } + + public override string RewardType() { return "unit"; } +} diff --git a/gateway.proto b/gateway.proto index 0496a457..d577de69 100644 --- a/gateway.proto +++ b/gateway.proto @@ -287,7 +287,11 @@ option csharp_namespace = "Protobuf.Messages"; uint32 level_number = 3; repeated Unit units = 4; repeated CurrencyReward currency_rewards = 5; - uint32 experience_reward = 6; + repeated ItemReward item_rewards = 6; + repeated UnitReward unit_rewards = 7; + uint32 experience_reward = 9; + repeated CurrencyCost attempt_cost = 10; + uint32 max_units = 8; } message CurrencyReward { @@ -295,6 +299,16 @@ option csharp_namespace = "Protobuf.Messages"; uint64 amount = 3; } + message ItemReward { + string item_template_name = 1; + uint32 level = 2; + } + + message UnitReward { + string character_name = 1; + uint32 rank = 4; + } + message AfkRewards { repeated AfkReward afk_rewards = 1; } From ca3b7b45305195ef1015c2c3aa7849d1864e19f3 Mon Sep 17 00:00:00 2001 From: lotuuu Date: Tue, 11 Jun 2024 18:32:23 -0300 Subject: [PATCH 2/4] Format code --- client/Assets/Scripts/Campaign/ItemReward.cs | 13 +++++-------- client/Assets/Scripts/Campaign/UnitReward.cs | 13 +++++-------- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/client/Assets/Scripts/Campaign/ItemReward.cs b/client/Assets/Scripts/Campaign/ItemReward.cs index 4b607ed6..d5ed9e06 100644 --- a/client/Assets/Scripts/Campaign/ItemReward.cs +++ b/client/Assets/Scripts/Campaign/ItemReward.cs @@ -1,8 +1,5 @@ -using System.Collections; -using System.Collections.Generic; - -public class ItemReward -{ - public ItemTemplate itemTemplate; - public int level; -} +public class ItemReward +{ + public ItemTemplate itemTemplate; + public int level; +} diff --git a/client/Assets/Scripts/Campaign/UnitReward.cs b/client/Assets/Scripts/Campaign/UnitReward.cs index 4d216e65..97036fe0 100644 --- a/client/Assets/Scripts/Campaign/UnitReward.cs +++ b/client/Assets/Scripts/Campaign/UnitReward.cs @@ -1,8 +1,5 @@ -using System.Collections; -using System.Collections.Generic; - -public class UnitReward -{ - public Character character; - public int rank; -} +public class UnitReward +{ + public Character character; + public int rank; +} From ae17889c8dc05a685305b85a77e9997b3d62fb02 Mon Sep 17 00:00:00 2001 From: lotuuu Date: Wed, 12 Jun 2024 18:30:05 -0300 Subject: [PATCH 3/4] Refactor CurrencyRewards, fix experience, add amount to rewards --- .../BackendConnection/SocketConnection.cs | 23 +- client/Assets/Scripts/Battle/BattleManager.cs | 21 +- .../Assets/Scripts/Campaign/CurrencyReward.cs | 6 + .../Scripts/Campaign/CurrencyReward.cs.meta | 11 + client/Assets/Scripts/Campaign/ItemReward.cs | 2 +- client/Assets/Scripts/Campaign/LevelData.cs | 3 +- client/Assets/Scripts/Campaign/UnitReward.cs | 1 + client/Assets/Scripts/Protobuf/Gateway.pb.cs | 201 +++++++++++------- .../Scripts/Shared/RewardsUIContainer.cs | 2 +- client/Assets/Scripts/Shared/UIReward.cs | 33 ++- gateway.proto | 7 +- 11 files changed, 185 insertions(+), 125 deletions(-) create mode 100644 client/Assets/Scripts/Campaign/CurrencyReward.cs create mode 100644 client/Assets/Scripts/Campaign/CurrencyReward.cs.meta diff --git a/client/Assets/Scripts/BackendConnection/SocketConnection.cs b/client/Assets/Scripts/BackendConnection/SocketConnection.cs index d0aed184..f1367584 100644 --- a/client/Assets/Scripts/BackendConnection/SocketConnection.cs +++ b/client/Assets/Scripts/BackendConnection/SocketConnection.cs @@ -270,21 +270,27 @@ private List ParseCampaignsFromResponse(Protobuf.Messages.Campaigns ca levelNumber = (int)level.LevelNumber, campaignId = level.CampaignId, units = levelUnits, - currencyRewards = GetLevelCurrencyRewards(level), - itemRewards = level.ItemRewards.Select(itemReward => new ItemReward + currencyRewards = level.CurrencyRewards.Select(currencyReward => new CurrencyReward + { + currency = GlobalUserData.Instance.AvailableCurrencies.Find(currency => currency.name == currencyReward.Currency.Name), + amount = (int)currencyReward.Amount + }).ToList(), + itemRewards = level.ItemRewards.Select(itemReward => + new ItemReward { itemTemplate = GlobalUserData.Instance.AvailableItemTemplates.Find(itemTemplate => itemTemplate.name.ToLower() == itemReward.ItemTemplateName.ToLower()), - level = (int)itemReward.Level + amount = (int)itemReward.Amount }).ToList(), unitRewards = level.UnitRewards.Select(unitReward => new UnitReward { character = availableCharacters.Find(character => character.name.ToLower() == unitReward.CharacterName.ToLower()), - rank = (int)unitReward.Rank + rank = (int)unitReward.Rank, + amount = (int)unitReward.Amount }).ToList(), + experienceReward = (int)level.ExperienceReward, status = levelStatus }); - if (levelStatus == LevelProgress.Status.Unlocked) { levelStatus = LevelProgress.Status.Locked; @@ -843,13 +849,6 @@ private void AwaitFuseUnitsResponse(byte[] data, Action onSuccess, Action< } } - private Dictionary GetLevelCurrencyRewards(Level level) - { - Dictionary rewards = level.CurrencyRewards.ToDictionary(currencyReward => currencyReward.Currency.Name, currencyReward => (int)currencyReward.Amount); - rewards.Add("Experience", (int)level.ExperienceReward); - return rewards; - } - public void GetAfkRewards(string userId, Action> onAfkRewardsReceived) { GetAfkRewards getAfkRewardsRequest = new GetAfkRewards diff --git a/client/Assets/Scripts/Battle/BattleManager.cs b/client/Assets/Scripts/Battle/BattleManager.cs index 99496812..f668a147 100644 --- a/client/Assets/Scripts/Battle/BattleManager.cs +++ b/client/Assets/Scripts/Battle/BattleManager.cs @@ -211,7 +211,7 @@ private void HandleBattleResult(bool result) Debug.LogError(ex.Message); } GlobalUserData user = GlobalUserData.Instance; - user.AddCurrencies(GetLevelRewards()); + user.AddCurrencies(GetLevelCurrencyRewards()); victorySplash.GetComponentInChildren().Populate(CreateRewardsList()); victorySplash.SetActive(true); victorySplash.GetComponent().Play(); @@ -303,9 +303,14 @@ private void ProcessExecutionsReceived(IEnumerable act } } - private Dictionary GetLevelRewards() + private Dictionary GetLevelCurrencyRewards() { - Dictionary rewards = LevelProgress.selectedLevelData.currencyRewards; + Dictionary rewards = new(); + foreach (var currencyReward in LevelProgress.selectedLevelData.currencyRewards) + { + rewards.Add(currencyReward.currency.name, currencyReward.amount); + } + if (LevelProgress.selectedLevelData.experienceReward > 0) { rewards.Add("Experience", LevelProgress.selectedLevelData.experienceReward); @@ -337,10 +342,7 @@ private List CreateRewardsList() foreach (var currencyReward in LevelProgress.selectedLevelData.currencyRewards) { - if (currencyReward.Value > 0) - { - rewards.Add(new CurrencyUIReward(currencyReward.Key, currencyReward.Value)); - } + rewards.Add(new CurrencyUIReward(currencyReward)); } foreach (var unitReward in LevelProgress.selectedLevelData.unitRewards) @@ -353,6 +355,11 @@ private List CreateRewardsList() rewards.Add(new ItemUIReward(itemReward)); } + if (LevelProgress.selectedLevelData.experienceReward > 0) + { + rewards.Add(new ExperienceUIReward(LevelProgress.selectedLevelData.experienceReward)); + } + return rewards; } diff --git a/client/Assets/Scripts/Campaign/CurrencyReward.cs b/client/Assets/Scripts/Campaign/CurrencyReward.cs new file mode 100644 index 00000000..f01dc27f --- /dev/null +++ b/client/Assets/Scripts/Campaign/CurrencyReward.cs @@ -0,0 +1,6 @@ +public class CurrencyReward +{ + + public Currency currency; + public int amount; +} diff --git a/client/Assets/Scripts/Campaign/CurrencyReward.cs.meta b/client/Assets/Scripts/Campaign/CurrencyReward.cs.meta new file mode 100644 index 00000000..d28a81b7 --- /dev/null +++ b/client/Assets/Scripts/Campaign/CurrencyReward.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: be24b8dc199dc44e8aaeb3ab877c1014 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/client/Assets/Scripts/Campaign/ItemReward.cs b/client/Assets/Scripts/Campaign/ItemReward.cs index d5ed9e06..b02ae66a 100644 --- a/client/Assets/Scripts/Campaign/ItemReward.cs +++ b/client/Assets/Scripts/Campaign/ItemReward.cs @@ -1,5 +1,5 @@ public class ItemReward { public ItemTemplate itemTemplate; - public int level; + public int amount; } diff --git a/client/Assets/Scripts/Campaign/LevelData.cs b/client/Assets/Scripts/Campaign/LevelData.cs index 35684945..0b297480 100644 --- a/client/Assets/Scripts/Campaign/LevelData.cs +++ b/client/Assets/Scripts/Campaign/LevelData.cs @@ -9,8 +9,7 @@ public class LevelData public string campaignId; public List units; - public Dictionary currencyRewards = new Dictionary(); - + public List currencyRewards = new(); public List itemRewards = new(); public List unitRewards = new(); diff --git a/client/Assets/Scripts/Campaign/UnitReward.cs b/client/Assets/Scripts/Campaign/UnitReward.cs index 97036fe0..a598c813 100644 --- a/client/Assets/Scripts/Campaign/UnitReward.cs +++ b/client/Assets/Scripts/Campaign/UnitReward.cs @@ -2,4 +2,5 @@ public class UnitReward { public Character character; public int rank; + public int amount; } diff --git a/client/Assets/Scripts/Protobuf/Gateway.pb.cs b/client/Assets/Scripts/Protobuf/Gateway.pb.cs index 59688e03..d2105700 100644 --- a/client/Assets/Scripts/Protobuf/Gateway.pb.cs +++ b/client/Assets/Scripts/Protobuf/Gateway.pb.cs @@ -129,57 +129,57 @@ static GatewayReflection() { "cmRzGAcgAygLMgsuVW5pdFJld2FyZBIZChFleHBlcmllbmNlX3Jld2FyZBgJ", "IAEoDRIjCgxhdHRlbXB0X2Nvc3QYCiADKAsyDS5DdXJyZW5jeUNvc3QSEQoJ", "bWF4X3VuaXRzGAggASgNIj0KDkN1cnJlbmN5UmV3YXJkEhsKCGN1cnJlbmN5", - "GAEgASgLMgkuQ3VycmVuY3kSDgoGYW1vdW50GAMgASgEIjcKCkl0ZW1SZXdh", - "cmQSGgoSaXRlbV90ZW1wbGF0ZV9uYW1lGAEgASgJEg0KBWxldmVsGAIgASgN", - "IjIKClVuaXRSZXdhcmQSFgoOY2hhcmFjdGVyX25hbWUYASABKAkSDAoEcmFu", - "axgEIAEoDSItCgpBZmtSZXd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ABKAkiPwoLVGFnUmVjZWl2", + "ZWQSEAoIc2tpbGxfaWQYASABKAkSEQoJdGFyZ2V0X2lkGAIgASgJEgsKA3Rh", + "ZxgDIAEoCSJvCg9Nb2RpZmllckV4cGlyZWQSEAoIc2tpbGxfaWQYASABKAkS", + "EQoJdGFyZ2V0X2lkGAIgASgJEiQKDXN0YXRfYWZmZWN0ZWQYAyABKAsyDS5T", + "dGF0QWZmZWN0ZWQSEQoJb3BlcmF0aW9uGAQgASgJIj4KClRhZ0V4cGlyZWQS", + "EAoIc2tpbGxfaWQYASABKAkSEQoJdGFyZ2V0X2lkGAIgASgJEgsKA3RhZxgD", + "IAEoCSIYCgVEZWF0aBIPCgd1bml0X2lkGAEgASgJIkIKC0VuZXJneVJlZ2Vu", + "EhEKCXRhcmdldF9pZBgBIAEoCRIQCghza2lsbF9pZBgCIAEoCRIOCgZhbW91", + "bnQYAyABKAIiRwoMU3RhdE92ZXJyaWRlEhEKCXRhcmdldF9pZBgBIAEoCRIk", + "Cg1zdGF0X2FmZmVjdGVkGAIgASgLMg0uU3RhdEFmZmVjdGVkKlsKD1NraWxs", + "QWN0aW9uVHlwZRITCg9BTklNQVRJT05fU1RBUlQQABISCg5FRkZFQ1RfVFJJ", + "R0dFUhABEg4KCkVGRkVDVF9ISVQQAhIPCgtFRkZFQ1RfTUlTUxADKlgKBFN0", + "YXQSCgoGSEVBTFRIEAASCgoGRU5FUkdZEAESCgoGQVRUQUNLEAISCwoHREVG", + "RU5TRRADEhQKEERBTUFHRV9SRURVQ1RJT04QBBIJCgVTUEVFRBAFQhSqAhFQ", + "cm90b2J1Zi5NZXNzYWdlc2IGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Protobuf.Messages.SkillActionType), typeof(global::Protobuf.Messages.Stat), }, null, new pbr::GeneratedClrTypeInfo[] { @@ -228,8 +228,8 @@ static GatewayReflection() { new pbr::GeneratedClrTypeInfo(typeof(global::Protobuf.Messages.Campaign), global::Protobuf.Messages.Campaign.Parser, new[]{ "Id", "SuperCampaignName", "CampaignNumber", "Levels" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Protobuf.Messages.Level), global::Protobuf.Messages.Level.Parser, new[]{ "Id", "CampaignId", "LevelNumber", "Units", "CurrencyRewards", "ItemRewards", "UnitRewards", "ExperienceReward", "AttemptCost", "MaxUnits" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Protobuf.Messages.CurrencyReward), global::Protobuf.Messages.CurrencyReward.Parser, new[]{ "Currency", "Amount" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Protobuf.Messages.ItemReward), global::Protobuf.Messages.ItemReward.Parser, new[]{ "ItemTemplateName", "Level" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Protobuf.Messages.UnitReward), global::Protobuf.Messages.UnitReward.Parser, new[]{ "CharacterName", "Rank" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Protobuf.Messages.ItemReward), global::Protobuf.Messages.ItemReward.Parser, new[]{ "ItemTemplateName", "Amount" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Protobuf.Messages.UnitReward), global::Protobuf.Messages.UnitReward.Parser, new[]{ "CharacterName", "Rank", "Amount" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Protobuf.Messages.AfkRewards), global::Protobuf.Messages.AfkRewards.Parser, new[]{ "AfkRewards_" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Protobuf.Messages.AfkReward), global::Protobuf.Messages.AfkReward.Parser, new[]{ "Currency", "Amount" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Protobuf.Messages.Error), global::Protobuf.Messages.Error.Parser, new[]{ "Reason" }, null, null, null, null), @@ -13315,7 +13315,7 @@ public CurrencyReward Clone() { } /// Field number for the "amount" field. - public const int AmountFieldNumber = 3; + public const int AmountFieldNumber = 2; private ulong amount_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] @@ -13375,7 +13375,7 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteMessage(Currency); } if (Amount != 0UL) { - output.WriteRawTag(24); + output.WriteRawTag(16); output.WriteUInt64(Amount); } if (_unknownFields != null) { @@ -13393,7 +13393,7 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteMessage(Currency); } if (Amount != 0UL) { - output.WriteRawTag(24); + output.WriteRawTag(16); output.WriteUInt64(Amount); } if (_unknownFields != null) { @@ -13455,7 +13455,7 @@ public void MergeFrom(pb::CodedInputStream input) { input.ReadMessage(Currency); break; } - case 24: { + case 16: { Amount = input.ReadUInt64(); break; } @@ -13481,7 +13481,7 @@ public void MergeFrom(pb::CodedInputStream input) { input.ReadMessage(Currency); break; } - case 24: { + case 16: { Amount = input.ReadUInt64(); break; } @@ -13528,7 +13528,7 @@ public ItemReward() { [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ItemReward(ItemReward other) : this() { itemTemplateName_ = other.itemTemplateName_; - level_ = other.level_; + amount_ = other.amount_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -13550,15 +13550,15 @@ public string ItemTemplateName { } } - /// Field number for the "level" field. - public const int LevelFieldNumber = 2; - private uint level_; + /// Field number for the "amount" field. + public const int AmountFieldNumber = 2; + private uint amount_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public uint Level { - get { return level_; } + public uint Amount { + get { return amount_; } set { - level_ = value; + amount_ = value; } } @@ -13578,7 +13578,7 @@ public bool Equals(ItemReward other) { return true; } if (ItemTemplateName != other.ItemTemplateName) return false; - if (Level != other.Level) return false; + if (Amount != other.Amount) return false; return Equals(_unknownFields, other._unknownFields); } @@ -13587,7 +13587,7 @@ public bool Equals(ItemReward other) { public override int GetHashCode() { int hash = 1; if (ItemTemplateName.Length != 0) hash ^= ItemTemplateName.GetHashCode(); - if (Level != 0) hash ^= Level.GetHashCode(); + if (Amount != 0) hash ^= Amount.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -13610,9 +13610,9 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(10); output.WriteString(ItemTemplateName); } - if (Level != 0) { + if (Amount != 0) { output.WriteRawTag(16); - output.WriteUInt32(Level); + output.WriteUInt32(Amount); } if (_unknownFields != null) { _unknownFields.WriteTo(output); @@ -13628,9 +13628,9 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(10); output.WriteString(ItemTemplateName); } - if (Level != 0) { + if (Amount != 0) { output.WriteRawTag(16); - output.WriteUInt32(Level); + output.WriteUInt32(Amount); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); @@ -13645,8 +13645,8 @@ public int CalculateSize() { if (ItemTemplateName.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(ItemTemplateName); } - if (Level != 0) { - size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Level); + if (Amount != 0) { + size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Amount); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); @@ -13663,8 +13663,8 @@ public void MergeFrom(ItemReward other) { if (other.ItemTemplateName.Length != 0) { ItemTemplateName = other.ItemTemplateName; } - if (other.Level != 0) { - Level = other.Level; + if (other.Amount != 0) { + Amount = other.Amount; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -13686,7 +13686,7 @@ public void MergeFrom(pb::CodedInputStream input) { break; } case 16: { - Level = input.ReadUInt32(); + Amount = input.ReadUInt32(); break; } } @@ -13709,7 +13709,7 @@ public void MergeFrom(pb::CodedInputStream input) { break; } case 16: { - Level = input.ReadUInt32(); + Amount = input.ReadUInt32(); break; } } @@ -13756,6 +13756,7 @@ public UnitReward() { public UnitReward(UnitReward other) : this() { characterName_ = other.characterName_; rank_ = other.rank_; + amount_ = other.amount_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -13778,7 +13779,7 @@ public string CharacterName { } /// Field number for the "rank" field. - public const int RankFieldNumber = 4; + public const int RankFieldNumber = 2; private uint rank_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] @@ -13789,6 +13790,18 @@ public uint Rank { } } + /// Field number for the "amount" field. + public const int AmountFieldNumber = 3; + private uint amount_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public uint Amount { + get { return amount_; } + set { + amount_ = value; + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { @@ -13806,6 +13819,7 @@ public bool Equals(UnitReward other) { } if (CharacterName != other.CharacterName) return false; if (Rank != other.Rank) return false; + if (Amount != other.Amount) return false; return Equals(_unknownFields, other._unknownFields); } @@ -13815,6 +13829,7 @@ public override int GetHashCode() { int hash = 1; if (CharacterName.Length != 0) hash ^= CharacterName.GetHashCode(); if (Rank != 0) hash ^= Rank.GetHashCode(); + if (Amount != 0) hash ^= Amount.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -13838,9 +13853,13 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteString(CharacterName); } if (Rank != 0) { - output.WriteRawTag(32); + output.WriteRawTag(16); output.WriteUInt32(Rank); } + if (Amount != 0) { + output.WriteRawTag(24); + output.WriteUInt32(Amount); + } if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -13856,9 +13875,13 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteString(CharacterName); } if (Rank != 0) { - output.WriteRawTag(32); + output.WriteRawTag(16); output.WriteUInt32(Rank); } + if (Amount != 0) { + output.WriteRawTag(24); + output.WriteUInt32(Amount); + } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } @@ -13875,6 +13898,9 @@ public int CalculateSize() { if (Rank != 0) { size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Rank); } + if (Amount != 0) { + size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Amount); + } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -13893,6 +13919,9 @@ public void MergeFrom(UnitReward other) { if (other.Rank != 0) { Rank = other.Rank; } + if (other.Amount != 0) { + Amount = other.Amount; + } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -13912,10 +13941,14 @@ public void MergeFrom(pb::CodedInputStream input) { CharacterName = input.ReadString(); break; } - case 32: { + case 16: { Rank = input.ReadUInt32(); break; } + case 24: { + Amount = input.ReadUInt32(); + break; + } } } #endif @@ -13935,10 +13968,14 @@ public void MergeFrom(pb::CodedInputStream input) { CharacterName = input.ReadString(); break; } - case 32: { + case 16: { Rank = input.ReadUInt32(); break; } + case 24: { + Amount = input.ReadUInt32(); + break; + } } } } diff --git a/client/Assets/Scripts/Shared/RewardsUIContainer.cs b/client/Assets/Scripts/Shared/RewardsUIContainer.cs index e65b1c92..0a16a761 100644 --- a/client/Assets/Scripts/Shared/RewardsUIContainer.cs +++ b/client/Assets/Scripts/Shared/RewardsUIContainer.cs @@ -18,7 +18,7 @@ public void Populate(List rewards) GameObject rewardUIItem = Instantiate(rewardItemUIPrefab, gameObject.transform); rewardUIItem.GetComponent().sprite = reward.Sprite(); rewardUIItem.GetComponentInChildren().text = reward.Amount().ToString(); - rewardUIItemDictionary.Add(reward.RewardType(), rewardUIItem); + rewardUIItemDictionary.Add(reward.GetName(), rewardUIItem); }); gameObject.SetActive(true); } diff --git a/client/Assets/Scripts/Shared/UIReward.cs b/client/Assets/Scripts/Shared/UIReward.cs index f42a0177..b21191b3 100644 --- a/client/Assets/Scripts/Shared/UIReward.cs +++ b/client/Assets/Scripts/Shared/UIReward.cs @@ -7,38 +7,36 @@ public Sprite Sprite() { return RewardType() switch { - "experience" => GlobalUserData.Instance.AvailableCurrencies.Single(currency => currency.name == "experience").image, + "experience" => GlobalUserData.Instance.AvailableCurrencies.Single(currency => currency.name == "Experience").image, "item" => ((ItemUIReward)this).itemReward.itemTemplate.icon, "unit" => ((UnitUIReward)this).unitReward.character.defaultSprite, - // If it's not any of the other 3, then it's a Currency - _ => GlobalUserData.Instance.AvailableCurrencies.Single(currency => currency.name == RewardType()).image + "currency" => ((CurrencyUIReward)this).currencyReward.currency.image, + _ => throw new System.Exception("Reward type " + RewardType() + " not recognized") }; } public abstract int Amount(); - public abstract string RewardType(); + public abstract string GetName(); } public class CurrencyUIReward : UIReward { - private string currency; - private int amount; + public CurrencyReward currencyReward; - public CurrencyUIReward(string currency, int amount) + public CurrencyUIReward(CurrencyReward currencyReward) { - this.currency = currency; - this.amount = amount; + this.currencyReward = currencyReward; } - public override int Amount() { return amount; } - - public override string RewardType() { return currency; } + public override int Amount() { return currencyReward.amount; } + public override string RewardType() { return "currency"; } + public override string GetName() { return currencyReward.currency.name; } } public class ExperienceUIReward : UIReward { - private int value; + private readonly int value; public ExperienceUIReward(int amount) { @@ -47,6 +45,7 @@ public ExperienceUIReward(int amount) public override int Amount() { return value; } public override string RewardType() { return "experience"; } + public override string GetName() { return "Experience"; } } public class ItemUIReward : UIReward @@ -58,9 +57,9 @@ public ItemUIReward(ItemReward itemReward) this.itemReward = itemReward; } - public override int Amount() { return 1; } - + public override int Amount() { return itemReward.amount; } public override string RewardType() { return "item"; } + public override string GetName() { return itemReward.itemTemplate.name; } } public class UnitUIReward : UIReward @@ -71,7 +70,7 @@ public UnitUIReward(UnitReward unitReward) this.unitReward = unitReward; } - public override int Amount() { return 1; } - + public override int Amount() { return unitReward.amount; } public override string RewardType() { return "unit"; } + public override string GetName() { return unitReward.character.name; } } diff --git a/gateway.proto b/gateway.proto index d577de69..02db68c5 100644 --- a/gateway.proto +++ b/gateway.proto @@ -296,17 +296,18 @@ option csharp_namespace = "Protobuf.Messages"; message CurrencyReward { Currency currency = 1; - uint64 amount = 3; + uint64 amount = 2; } message ItemReward { string item_template_name = 1; - uint32 level = 2; + uint32 amount = 2; } message UnitReward { string character_name = 1; - uint32 rank = 4; + uint32 rank = 2; + uint32 amount = 3; } message AfkRewards { From 4071d4f922e17f315d0e2b0a2c7380b40b648fd1 Mon Sep 17 00:00:00 2001 From: lotuuu Date: Wed, 12 Jun 2024 18:59:47 -0300 Subject: [PATCH 4/4] Format files --- client/Assets/Scripts/Campaign/CurrencyReward.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/client/Assets/Scripts/Campaign/CurrencyReward.cs b/client/Assets/Scripts/Campaign/CurrencyReward.cs index f01dc27f..73a0276c 100644 --- a/client/Assets/Scripts/Campaign/CurrencyReward.cs +++ b/client/Assets/Scripts/Campaign/CurrencyReward.cs @@ -1,6 +1,5 @@ -public class CurrencyReward -{ - - public Currency currency; - public int amount; -} +public class CurrencyReward +{ + public Currency currency; + public int amount; +}