Exemplo n.º 1
0
 protected virtual bool isIGBPISavingPermitted(ECharacterType _cType, out CharacterTactics _tactics)
 {
     _tactics = GetTacticsFromCharacter(_cType);
     if (_tactics.CharacterType == ECharacterType.NoCharacterType)
     {
         Debug.LogError("No IGBPI Data Object on Save Manager For Character Type " + _tactics.CharacterType.ToString());
         return(false);
     }
     if (dataHandler == null)
     {
         Debug.LogError("No Data Handler could be found.");
         return(false);
     }
     return(true);
 }
Exemplo n.º 2
0
        protected virtual void Save_IGBPI_Values(ECharacterType _cType, List <IGBPIPanelValue> _values)
        {
            CharacterTactics _tactics;

            if (!isIGBPISavingPermitted(_cType, out _tactics))
            {
                return;
            }

            List <CharacterTactics> _allCharacterTactics = LoadCharacterTacticsList();
            int _indexOf = -1;
            CharacterTactics _characterToChange = new CharacterTactics
            {
                CharacterName = "",
                CharacterType = ECharacterType.NoCharacterType,
                Tactics       = new List <IGBPIPanelValue>()
            };

            foreach (var _checkCharacter in _allCharacterTactics)
            {
                if (_cType != ECharacterType.NoCharacterType &&
                    _checkCharacter.CharacterType == _cType)
                {
                    _indexOf = _allCharacterTactics.IndexOf(_checkCharacter);
                    _characterToChange.CharacterName = _checkCharacter.CharacterName;
                    _characterToChange.CharacterType = _checkCharacter.CharacterType;
                    _characterToChange.Tactics       = ValidateIGBPIValues(_values);
                }
            }

            if (_characterToChange.CharacterType != ECharacterType.NoCharacterType &&
                _indexOf != -1)
            {
                _allCharacterTactics[_indexOf] = _characterToChange;
                statHandler.UpdateTacticsDictionary(_allCharacterTactics);
                SaveXMLTactics(_allCharacterTactics);
            }
        }