public CharStatsData StatsAsData() { CharStatsData statsData = new CharStatsData(); statsData.Status = this.Status; statsData.HP = this.HP; statsData.MaxHP = this.MaxHP; statsData.AP = this.AP; statsData.Strength = this.Strength; statsData.Stamina = this.Stamina; statsData.WillPower = this.WillPower; statsData.Intelligence = this.Intelligence; statsData.Speed = this.Speed; statsData.CombatAbilities = this.CombatAbilities; statsData.CharName = this.CharName; statsData.ID = this.ID; statsData.DialogMgr = this.DialogMgr; statsData.charSprite = this.charSprite; statsData.XP = this.XP; statsData.FocusType = this.FocusType; statsData.BehaviorType = this.BehaviorType; statsData.AnimatorType = this.AnimatorType; return(statsData); }
public void StartLoadingCombat(List <CharMgrScript> EnemyParty) { //Check to make sure combat scene isn't already loaded if (SceneManager.GetActiveScene().buildIndex == (int)GameConstants.SceneIndices.CombatScene) { Debug.LogWarning("Game is already in combat but StartLoadingCombat() Called."); } else { //Clear enemy party of old data if necessary before loading new enemies if (this.EnemyPartyData.Count > 0) { this.EnemyPartyData.Clear(); } //Get the data for the new enemy's party foreach (CharMgrScript enemyScript in EnemyParty) { CharStatsData enemyData = new CharStatsData(); enemyData = enemyScript.stats.StatsAsData(); EnemyPartyData.Add(enemyData); } //Start loading combat scene StartCoroutine(LoadCombatAsync()); } }
public void UpdateSelectedCharactersList(bool toggleVal, CharStatsData data) { Debug.Log("UpdateSelectedCharactersListCalled" + toggleVal.ToString()); Debug.Log("Character selected/deselected! : " + data.CharName); if (toggleVal) { this.selectedCharacters.Add(data); //Add Image to UI this.UpdateDisplayAddSelectedCharacter(data.ID, data.charSprite, data.CharName); } else { this.selectedCharacters.Remove(data); //Remove Image from UI } Debug.Log("Number of characters currently selected is:" + this.selectedCharacters.Count.ToString()); }
//=========================Internals========================= List <GameObject> PopulateCharacterSelectUiEntries() { List <GameObject> uiEntries = new List <GameObject>(); //Get the data for the player's party foreach (CharStatsScript charScript in this.selectableCharacters) { CharStatsData charData = new CharStatsData(); charData = charScript.StatsAsData(); this.characterData.Add(charData); //Create button for scrollview GameObject obj = GameObject.Instantiate(this.uiElemCharEntry); obj.GetComponent <UICharacterEntryScript>().Init(charData); uiEntries.Add(obj); } //TODO: Get the data for the new enemy's party return(uiEntries); }
// Use this for initialization void Start() { //Initialize player inventory PlayerInventory = new Inventory(); //Initialize player party if (PlayerParty == null) { PlayerParty = new List <CharStatsData>(); } if (this._playerStats == null) { this.GetComponent <CharMgrScript>().Init(); this._playerStats = this.GetComponent <CharMgrScript>().stats.StatsAsData(); } //Add player to player party if not already in list if (!PlayerParty.Contains(this._playerStats)) { PlayerParty.Add(this._playerStats); } }
public void Copy(CharStatsData StatsToCopy) { this.Status = StatsToCopy.Status; this.HP = StatsToCopy.HP; this.MaxHP = StatsToCopy.MaxHP; this.AP = StatsToCopy.AP; this.Strength = StatsToCopy.Strength; this.Stamina = StatsToCopy.Stamina; this.WillPower = StatsToCopy.WillPower; this.Intelligence = StatsToCopy.Intelligence; this.Speed = StatsToCopy.Speed; this.CombatAbilities = StatsToCopy.CombatAbilities; this.CharName = StatsToCopy.CharName; this.ID = StatsToCopy.ID; this.DialogMgr = StatsToCopy.DialogMgr; this.charSprite = StatsToCopy.charSprite; this.FocusType = StatsToCopy.FocusType; this.BehaviorType = StatsToCopy.BehaviorType; this.AnimatorType = StatsToCopy.AnimatorType; }
/// <summary> /// Initializes this instance. /// </summary> public void Init() { if (this.GetComponent <SpriteRenderer>() == null) { Debug.LogError("Sprite renderer on player object not found!"); } else { _playerSprite = this.GetComponent <SpriteRenderer>(); } //Initialize necessary variables for player party, etc. if (this._playerStats == null) { this.GetComponent <CharMgrScript>().Init(); this._playerStats = this.GetComponent <CharMgrScript>().stats.StatsAsData(); } //Add player to player party if not already in list if (!PlayerParty.Contains(this._playerStats)) { PlayerParty.Add(this._playerStats); } }
// Update existing entries in the table based on the iddemo_table void UpdateStat(CharStatsData entry) { // Setup the update query string query = "UPDATE character_create_stats"; query += " SET "; query += entry.UpdateList (); query += " WHERE id=?id"; // Setup the register data List<Register> update = new List<Register> (); foreach (string field in entry.fields.Keys) { update.Add (entry.fieldToRegister (field)); } update.Add (new Register ("id", "?id", MySqlDbType.Int32, entry.id.ToString (), Register.TypesOfField.Int)); // Update the database DatabasePack.Update (DatabasePack.contentDatabasePrefix, query, update); }
private void LoadStatList() { List<CharStatsData> charStats = new List<CharStatsData>(); foreach (string stat in statsList) { CharStatsData charStat = new CharStatsData(); charStat.stat = stat; charStat.statValue = 0; charStats.Add(charStat); } editingDisplay.charStats = charStats; }
void InsertStat(CharStatsData entry) { string query = "INSERT INTO character_create_stats"; query += " (character_create_id, stat, value, levelIncrease, levelPercentIncrease) "; query += "VALUES "; query += " (" + entry.charId + ",'" + entry.stat + "'," + entry.statValue + "," + entry.levelIncrease + "," + entry.levelPercentIncrease + ") "; // Setup the register data List<Register> update = new List<Register> (); foreach (string field in entry.fields.Keys) { update.Add (entry.fieldToRegister (field)); } int itemID = -1; itemID = DatabasePack.Insert (DatabasePack.contentDatabasePrefix, query, update); entry.id = itemID; }
// Load Stats public void LoadCharacterStats(CharData charData) { List<CharStatsData> charStats = new List<CharStatsData>(); // Read all entries from the table string query = "SELECT * FROM character_create_stats where character_create_id = " + charData.id; // If there is a row, clear it. if (rows != null) rows.Clear (); // Load data rows = DatabasePack.LoadData (DatabasePack.contentDatabasePrefix, query); // Read all the data if ((rows!=null) && (rows.Count > 0)) { foreach (Dictionary<string,string> data in rows) { CharStatsData display = new CharStatsData (); display.id = int.Parse (data ["id"]); display.charId = int.Parse (data ["character_create_id"]); display.stat = data ["stat"]; display.statValue = int.Parse (data ["value"]); display.levelIncrease = float.Parse (data ["levelIncrease"]); display.levelPercentIncrease = float.Parse (data ["levelPercentIncrease"]); charStats.Add(display); } } // Check for any stats the template may not have foreach (string stat in statsList) { bool statExists = false; foreach (CharStatsData charStat in charStats) { if (stat == charStat.stat) { statExists = true; } } if (!statExists) { CharStatsData statData = new CharStatsData(); statData.stat = stat; statData.statValue = 0; charStats.Add(statData); } } charData.charStats = charStats; }
public void Init(CharStatsData cStats) { this.InitLocalVariables(); this.charStatsData = cStats; this.SetFields(); }