コード例 #1
0
    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);
    }
コード例 #2
0
ファイル: GameStateMgr.cs プロジェクト: 12ooster/rpg-project
    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());
        }
    }
コード例 #3
0
 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());
 }
コード例 #4
0
    //=========================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);
    }
コード例 #5
0
 // 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);
     }
 }
コード例 #6
0
 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;
 }
コード例 #7
0
 /// <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);
     }
 }
コード例 #8
0
ファイル: ServerCharacter.cs プロジェクト: zukeru/ageofasura
    // 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);
    }
コード例 #9
0
ファイル: ServerCharacter.cs プロジェクト: zukeru/ageofasura
 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;
 }
コード例 #10
0
ファイル: ServerCharacter.cs プロジェクト: zukeru/ageofasura
    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;
    }
コード例 #11
0
ファイル: ServerCharacter.cs プロジェクト: zukeru/ageofasura
    // 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;
    }
コード例 #12
0
 public void Init(CharStatsData cStats)
 {
     this.InitLocalVariables();
     this.charStatsData = cStats;
     this.SetFields();
 }