示例#1
0
        public string Serialize()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("{");
            sb.Append(StringConverter.Serialize <Controller>(Controllers));
            sb.Append(",");
            sb.Append(Location.Serialize());
            sb.Append(",");
            sb.Append(NextLocation?.Serialize() ?? "<null>");
            sb.Append("}");
            return(sb.ToString());
        }
    /// <summary>
    /// Copies all the values from another BattleEntry.
    /// </summary>
    /// <param name="battle"></param>
    public override void CopyValues(ScrObjLibraryEntry other)
    {
        base.CopyValues(other);
        BattleEntry be = (BattleEntry)other;

        // General battle things
        escapeButtonEnabled = be.escapeButtonEnabled;

        // Tutorial stuff
        isTutorial          = be.isTutorial;
        backgroundHintLeft  = be.backgroundHintLeft;
        backgroundHintRight = be.backgroundHintRight;
        removeSide          = be.removeSide;
        playerInvincible    = be.playerInvincible;
        useSlowTime         = be.useSlowTime;

        // Background
        backgroundLeft  = be.backgroundLeft;
        backgroundRight = be.backgroundRight;

        // Enemies
        randomizeEnemies = be.randomizeEnemies;
        numberOfEnemies  = be.numberOfEnemies;
        enemyTypes       = new List <EnemyEntry>();
        for (int i = 0; i < be.enemyTypes.Count; i++)
        {
            enemyTypes.Add(be.enemyTypes[i]);
        }

        // Player stuff
        useSpecificKanji = be.useSpecificKanji;
        equippedKanji    = new Kanji[Constants.MAX_EQUIPPED_KANJI];
        for (int i = 0; i < be.equippedKanji.Length; i++)
        {
            equippedKanji[i] = be.equippedKanji[i];
        }

        // After match values
        nextLocation   = be.nextLocation;
        changePosition = be.changePosition;
        playerArea     = be.playerArea;
        playerPosition = be.playerPosition;
        nextDialogue   = be.nextDialogue;
        nextBattle     = be.nextBattle;
    }
示例#3
0
        public void Deserialize(string state)
        {
            List <string> tokens = StringConverter.DeserializeTokens(state);

            Controllers = StringConverter.Deserialize <Controller>(tokens[0], str => null);
            Location.Deserialize(tokens[1]);
            if (tokens[2] == "<null>")
            {
                NextLocation = null;
            }
            else if (NextLocation == null)
            {
                NextLocation = new Location();
                NextLocation.Deserialize(tokens[2]);
            }
            else
            {
                NextLocation.Deserialize(tokens[2]);
            }
        }
    /// <summary>
    /// Resets all values to start values.
    /// </summary>
    /// <param name="other"></param>
    public override void ResetValues()
    {
        base.ResetValues();

        // General battle things
        escapeButtonEnabled = true;

        // Tutorial stuff
        isTutorial          = false;
        backgroundHintLeft  = null;
        backgroundHintRight = null;
        removeSide          = RemoveSide.NONE;
        playerInvincible    = false;
        useSlowTime         = true;

        // Background
        backgroundLeft  = null;
        backgroundRight = null;

        // Enemies
        randomizeEnemies = false;
        numberOfEnemies  = 1;
        enemyTypes       = new List <EnemyEntry>();

        // Player stuff
        useSpecificKanji = true;
        equippedKanji    = new Kanji[Constants.MAX_EQUIPPED_KANJI];

        // After match values
        nextLocation   = NextLocation.OVERWORLD;
        changePosition = false;
        playerArea     = Constants.OverworldArea.DEFAULT;
        playerPosition = new Vector2();
        nextDialogue   = null;
        nextBattle     = null;
    }