// ------------------------------------------------------------------------------- // ActorPlayerLoad // ------------------------------------------------------------------------------- public GameObject ActorPlayerLoad(string sName) { if (String.IsNullOrWhiteSpace(sName) || !databaseProvider.RowExists(tableActorPlayers, fieldName, sName).Result ) { return(null); } GameObject actorObject = null; BaseDataTable data = databaseProvider.LoadAspects(sName).Result; // -- load the required prefab via the actors aspects for (int i = 0; i < data.Rows.Count; ++i) { TemplateAspect tmpl; if (DataManager.dictAspect.TryGetValue(data.GetIdHash(i), out tmpl)) { if (tmpl.actorPrefab) { actorObject = tmpl.actorPrefab; break; } } else { Debug.LogWarning("Skipped template '" + data.GetString(DatabaseManager.fieldName) + "' as it was not found in Library."); } } actorObject.GetComponent <MetaSubsystem>().Load(databaseProvider.LoadMeta(sName).Result); actorObject.GetComponent <AlignmentSubsystem>().Load(databaseProvider.LoadAlignments(sName).Result); actorObject.GetComponent <AspectSubsystem>().Load(databaseProvider.LoadAspects(sName).Result); actorObject.GetComponent <ProfessionSubsystem>().Load(databaseProvider.LoadProfessions(sName).Result); actorObject.GetComponent <AttributeSubsystem>().Load(databaseProvider.LoadAttributes(sName).Result); actorObject.GetComponent <CurrencySubsystem>().Load(databaseProvider.LoadCurrencies(sName).Result); actorObject.GetComponent <EnergySubsystem>().Load(databaseProvider.LoadEnergies(sName).Result); actorObject.GetComponent <EquipmentSubsystem>().Load(databaseProvider.LoadEquipment(sName).Result); actorObject.GetComponent <InventorySubsystem>().Load(databaseProvider.LoadInventory(sName).Result); actorObject.GetComponent <SkillSubsystem>().Load(databaseProvider.LoadSkills(sName).Result); actorObject.GetComponent <StatusSubsystem>().Load(databaseProvider.LoadStatus(sName).Result); return(actorObject); }
// ------------------------------------------------------------------------------- // Load // ------------------------------------------------------------------------------- public override void Load(BaseDataTable data) { syncAttributes.Clear(); for (int i = 0; i < data.Rows.Count; ++i) { TemplateAttribute tmpl; if (DataManager.dictAttribute.TryGetValue(data.GetIdHash(i), out tmpl)) { SAttribute sAttribute = new SAttribute(tmpl.GetId, data.GetLongAsInt(DatabaseManager.fieldValue, i)); syncAttributes.Add(sAttribute); } else { Debug.LogWarning("Skipped template '" + data.GetString(DatabaseManager.fieldName) + "' as it was not found in Library."); } } data.Cleanup(); }
// ------------------------------------------------------------------------------- // Load // ------------------------------------------------------------------------------- public override void Load(BaseDataTable data) { syncInventory.Clear(); for (int i = 0; i < data.Rows.Count; ++i) { TemplateItem tmpl; if (DataManager.dictItem.TryGetValue(data.GetIdHash(i), out tmpl)) { SItem sItem = new SItem(tmpl.GetId, data.GetLongAsInt(DatabaseManager.fieldSlot, i), data.GetLongAsInt(DatabaseManager.fieldAmount, i), data.GetLongAsInt(DatabaseManager.fieldAmmo, i), data.GetLongAsInt(DatabaseManager.fieldCharges, i), data.GetLongAsInt(DatabaseManager.fieldLevel, i)); syncInventory.Add(sItem); } else { Debug.LogWarning("Skipped template '" + data.GetString(DatabaseManager.fieldName) + "' as it was not found in Library."); } } data.Cleanup(); }
// ------------------------------------------------------------------------------- // Load // ------------------------------------------------------------------------------- public override void Load(BaseDataTable data) { syncStatus.Clear(); for (int i = 0; i < data.Rows.Count; ++i) { TemplateStatus tmpl; if (DataManager.dictStatus.TryGetValue(data.GetIdHash(i), out tmpl)) { SStatus sStatus = new SStatus(tmpl.GetId, data.GetLongAsInt(DatabaseManager.fieldLevel, i), data.GetDouble(DatabaseManager.fieldDuration, i)); syncStatus.Add(sStatus); } else { Debug.LogWarning("Skipped template '" + data.GetString(DatabaseManager.fieldName) + "' as it was not found in Library."); } } data.Cleanup(); }