public void Load(NodeSerializable serializable, Database database) { Message = serializable.Message; DefaultTransition = new NumericValue <int>(serializable.DefaultTransition, 0, 999999); Transitions = serializable.Transitions?.Select(item => new NodeTransition(item, database)).ToArray(); OnDataDeserialized(serializable, database); }
public void Load(NodeSerializable serializable, Database database) { Transition = new NumericValue <int>(serializable.DefaultTransition, 1, 1000); Faction = database.GetFactionId(serializable.Faction); Level = new NumericValue <int>(serializable.Value, 0, 10000); OnDataDeserialized(serializable, database); }
public Node(NodeSerializable serializable, Database database) { Id = new NumericValue <int>(serializable.Id, 1, 1000); Type = serializable.Type; _content = CreateContent(serializable.Type); _content.Load(serializable, database); OnDataDeserialized(serializable, database); }
public Content_AttackOccupants(NodeSerializable serializable, Database database) { if (serializable == null || database == null) { return; } VictoryTransition = new NumericValue <int>(serializable.DefaultTransition, 1, 1000); FailureTransition = new NumericValue <int>(serializable.FailureTransition, 1, 1000); }
public void Load(NodeSerializable serializable, Database database) { VictoryTransition = new NumericValue <int>(serializable.DefaultTransition, 1, 1000); FailureTransition = new NumericValue <int>(serializable.FailureTransition, 1, 1000); Enemy = database.GetFleetId(serializable.Enemy); Loot = database.GetLootId(serializable.Loot); OnDataDeserialized(serializable, database); }
public Node_ChangeCharacterRelations(NodeSerializable serializable, Database.Loader loader) : base(serializable, loader) { Transition = UnityEngine.Mathf.Clamp(serializable.DefaultTransition, 1, 1000); Character = loader.GetCharacter(new ItemId <Character>(serializable.Character)); Value = UnityEngine.Mathf.Clamp(serializable.Value, -100, 100); OnDataDeserialized(serializable, loader); }
public Content_Trade(NodeSerializable serializable, Database database) { if (serializable == null || database == null) { return; } Transition = new NumericValue <int>(serializable.DefaultTransition, 1, 1000); Loot = database.GetLootId(serializable.Loot); }
public Content_Condition(NodeSerializable serializable, Database database) { if (serializable == null || database == null) { return; } Message = serializable.Message; Transitions = serializable.Transitions?.Select(item => NodeTransitionData.Deserialize(item, database)).ToArray(); }
public NodeSerializable Serialize() { var serializable = new NodeSerializable(); serializable.DefaultTransition = Transition.Value; serializable.Faction = Faction.Id; serializable.Value = Level.Value; return(serializable); }
public Content_SetCharacterRelations(NodeSerializable serializable, Database database) { if (serializable == null || database == null) { return; } Transition = new NumericValue <int>(serializable.DefaultTransition, 1, 1000); Value = new NumericValue <int>(serializable.Value, -100, 100); }
public NodeSerializable Serialize() { var serializable = new NodeSerializable(); serializable.Message = Message; serializable.DefaultTransition = DefaultTransition.Value; serializable.Transitions = Transitions?.Select(item => item.Serialize()).ToArray(); return(serializable); }
public Node_Random(NodeSerializable serializable, Database.Loader loader) : base(serializable, loader) { Message = serializable.Message; DefaultTransition = UnityEngine.Mathf.Clamp(serializable.DefaultTransition, 0, 1000); Transitions = new ImmutableCollection <NodeTransition>(serializable.Transitions?.Select(item => NodeTransition.Create(item, loader))); OnDataDeserialized(serializable, loader); }
public Content_StartQuest(NodeSerializable serializable, Database database) { if (serializable == null || database == null) { return; } Transition = new NumericValue <int>(serializable.DefaultTransition, 1, 1000); Quest = database.GetQuestId(serializable.Quest); }
public Node_OpenShipyard(NodeSerializable serializable, Database.Loader loader) : base(serializable, loader) { Transition = UnityEngine.Mathf.Clamp(serializable.DefaultTransition, 1, 1000); Faction = loader.GetFaction(new ItemId <Faction>(serializable.Faction)); Level = UnityEngine.Mathf.Clamp(serializable.Value, 0, 10000); OnDataDeserialized(serializable, loader); }
public Content_OpenShipyard(NodeSerializable serializable, Database database) { if (serializable == null || database == null) { return; } Transition = new NumericValue <int>(serializable.DefaultTransition, 1, 1000); Faction = database.GetFactionId(serializable.Faction); Level = new NumericValue <int>(serializable.Value, 0, 1000); }
public Content_Random(NodeSerializable serializable, Database database) { if (serializable == null || database == null) { return; } Message = serializable.Message; DefaultTransition = new NumericValue <int>(serializable.DefaultTransition, 0, 1000); Transitions = serializable.Transitions?.Select(item => NodeTransitionData.Deserialize(item, database)).ToArray(); }
public Node_AttackFleet(NodeSerializable serializable, Database.Loader loader) : base(serializable, loader) { VictoryTransition = UnityEngine.Mathf.Clamp(serializable.DefaultTransition, 1, 1000); FailureTransition = UnityEngine.Mathf.Clamp(serializable.FailureTransition, 1, 1000); Enemy = loader.GetFleet(new ItemId <Fleet>(serializable.Enemy)); Loot = loader.GetLoot(new ItemId <LootModel>(serializable.Loot)); OnDataDeserialized(serializable, loader); }
public NodeSerializable Serialize() { var serializable = new NodeSerializable(); serializable.DefaultTransition = VictoryTransition.Value; serializable.FailureTransition = FailureTransition.Value; serializable.Enemy = Enemy.Id; serializable.Loot = Loot.Id; return(serializable); }
public void Load(NodeSerializable serializable, Database database) { RequiredView = serializable.RequiredView; Message = serializable.Message; Enemy = database.GetFleetId(serializable.Enemy); Loot = database.GetLootId(serializable.Loot); Character = database.GetCharacterId(serializable.Character); Actions = serializable.Actions?.Select(item => new NodeAction(item, database)).ToArray(); OnDataDeserialized(serializable, database); }
public Content_AttackFleet(NodeSerializable serializable, Database database) { if (serializable == null || database == null) { return; } VictoryTransition = new NumericValue <int>(serializable.DefaultTransition, 1, 1000); FailureTransition = new NumericValue <int>(serializable.FailureTransition, 1, 1000); Enemy = database.GetFleetId(serializable.Enemy); Loot = database.GetLootId(serializable.Loot); }
public NodeSerializable Serialize() { var serializable = new NodeSerializable(); serializable.RequiredView = RequiredView; serializable.Message = Message; serializable.Enemy = Enemy.Id; serializable.Loot = Loot.Id; serializable.Character = Character.Id; serializable.Actions = Actions?.Select(item => item.Serialize()).ToArray(); return(serializable); }
public Node_ShowDialog(NodeSerializable serializable, Database.Loader loader) : base(serializable, loader) { RequiredView = serializable.RequiredView; Message = serializable.Message; Enemy = loader.GetFleet(new ItemId <Fleet>(serializable.Enemy)); Loot = loader.GetLoot(new ItemId <LootModel>(serializable.Loot)); Character = loader.GetCharacter(new ItemId <Character>(serializable.Character)); Actions = new ImmutableCollection <NodeAction>(serializable.Actions?.Select(item => NodeAction.Create(item, loader))); OnDataDeserialized(serializable, loader); }
public void Save(ref NodeSerializable serializable) { serializable.Message = Message; if (Transitions == null || Transitions.Length == 0) { serializable.Transitions = null; } else { serializable.Transitions = Transitions.Select(item => item.Serialize()).ToArray(); } OnDataSerialized(ref serializable); }
public Content_ShowDialog(NodeSerializable serializable, Database database) { if (serializable == null || database == null) { return; } RequiredView = serializable.RequiredView; Message = serializable.Message; Enemy = database.GetFleetId(serializable.Enemy); Loot = database.GetLootId(serializable.Loot); Character = database.GetCharacterId(serializable.Character); Actions = serializable.Actions?.Select(item => NodeActionData.Deserialize(item, database)).ToArray(); }
public void Save(ref NodeSerializable serializable) { serializable.RequiredView = RequiredView; serializable.Message = Message; serializable.Enemy = Enemy.Value; serializable.Loot = Loot.Value; serializable.Character = Character.Value; if (Actions == null || Actions.Length == 0) { serializable.Actions = null; } else { serializable.Actions = Actions.Select(item => item.Serialize()).ToArray(); } OnDataSerialized(ref serializable); }
public static Node Create(NodeSerializable serializable, Database.Loader loader) { switch (serializable.Type) { case NodeType.Undefined: return(new Node_Undefined(serializable, loader)); case NodeType.ComingSoon: return(new Node_ComingSoon(serializable, loader)); case NodeType.ShowDialog: return(new Node_ShowDialog(serializable, loader)); case NodeType.OpenShipyard: return(new Node_OpenShipyard(serializable, loader)); case NodeType.Switch: return(new Node_Switch(serializable, loader)); case NodeType.Random: return(new Node_Random(serializable, loader)); case NodeType.Condition: return(new Node_Condition(serializable, loader)); case NodeType.AttackFleet: return(new Node_AttackFleet(serializable, loader)); case NodeType.AttackOccupants: return(new Node_AttackOccupants(serializable, loader)); case NodeType.DestroyOccupants: return(new Node_DestroyOccupants(serializable, loader)); case NodeType.SuppressOccupants: return(new Node_SuppressOccupants(serializable, loader)); case NodeType.Retreat: return(new Node_Retreat(serializable, loader)); case NodeType.ReceiveItem: return(new Node_ReceiveItem(serializable, loader)); case NodeType.RemoveItem: return(new Node_RemoveItem(serializable, loader)); case NodeType.Trade: return(new Node_Trade(serializable, loader)); case NodeType.CompleteQuest: return(new Node_CompleteQuest(serializable, loader)); case NodeType.FailQuest: return(new Node_FailQuest(serializable, loader)); case NodeType.CancelQuest: return(new Node_CancelQuest(serializable, loader)); case NodeType.StartQuest: return(new Node_StartQuest(serializable, loader)); case NodeType.SetCharacterRelations: return(new Node_SetCharacterRelations(serializable, loader)); case NodeType.SetFactionRelations: return(new Node_SetFactionRelations(serializable, loader)); case NodeType.ChangeCharacterRelations: return(new Node_ChangeCharacterRelations(serializable, loader)); case NodeType.ChangeFactionRelations: return(new Node_ChangeFactionRelations(serializable, loader)); default: throw new DatabaseException("Node: Invalid content type - " + serializable.Type); } }
public Node_CancelQuest(NodeSerializable serializable, Database.Loader loader) : base(serializable, loader) { OnDataDeserialized(serializable, loader); }
partial void OnDataDeserialized(NodeSerializable serializable, Database.Loader loader);
private NodeData(NodeSerializable serializable, Database database) { Id = new NumericValue <int>(serializable.Id, 1, 1000); Type = serializable.Type; }
private void CreateContent(NodeSerializable serializable, Database database) { if (serializable.Type == NodeType.ShowDialog) { Content = new Content_ShowDialog(serializable, database); } else if (serializable.Type == NodeType.Switch) { Content = new Content_Switch(serializable, database); } else if (serializable.Type == NodeType.Condition) { Content = new Content_Condition(serializable, database); } else if (serializable.Type == NodeType.Random) { Content = new Content_Random(serializable, database); } else if (serializable.Type == NodeType.Retreat) { Content = new Content_Retreat(serializable, database); } else if (serializable.Type == NodeType.DestroyOccupants) { Content = new Content_DestroyOccupants(serializable, database); } else if (serializable.Type == NodeType.SuppressOccupants) { Content = new Content_SuppressOccupants(serializable, database); } else if (serializable.Type == NodeType.ReceiveItem) { Content = new Content_ReceiveItem(serializable, database); } else if (serializable.Type == NodeType.RemoveItem) { Content = new Content_RemoveItem(serializable, database); } else if (serializable.Type == NodeType.Trade) { Content = new Content_Trade(serializable, database); } else if (serializable.Type == NodeType.StartQuest) { Content = new Content_StartQuest(serializable, database); } else if (serializable.Type == NodeType.ChangeFactionRelations) { Content = new Content_ChangeFactionRelations(serializable, database); } else if (serializable.Type == NodeType.SetFactionRelations) { Content = new Content_SetFactionRelations(serializable, database); } else if (serializable.Type == NodeType.ChangeCharacterRelations) { Content = new Content_ChangeCharacterRelations(serializable, database); } else if (serializable.Type == NodeType.SetCharacterRelations) { Content = new Content_SetCharacterRelations(serializable, database); } else if (serializable.Type == NodeType.OpenShipyard) { Content = new Content_OpenShipyard(serializable, database); } else if (serializable.Type == NodeType.AttackFleet) { Content = new Content_AttackFleet(serializable, database); } else if (serializable.Type == NodeType.AttackOccupants) { Content = new Content_AttackOccupants(serializable, database); } else { Content = new Content_Empty(); } }