Example #1
0
    public void LoadSkirmishData(SkirmishData data)
    {
        skirmishParticipants.Clear();
        for (int i = 0; i < data.skirmishParticipants.Count; i++)
        {
            skirmishParticipants.Add(GameManager.Instance.specialAdventurers[data.skirmishParticipants[i]].GetComponent <SpecialAdventurer>());
        }

        skirmishLosers.Clear();
        for (int i = 0; i < data.skirmishLosers.Count; i++)
        {
            skirmishLosers.Add(GameManager.Instance.specialAdventurers[data.skirmishLosers[i]].GetComponent <SpecialAdventurer>());
        }

        skirmishBracket.Clear();
        for (int i = 0; i < data.skirmishBracket.Count; i++)
        {
            skirmishBracket.Add(GameManager.Instance.specialAdventurers[data.skirmishBracket[i]].GetComponent <SpecialAdventurer>());
        }

        roundCnt         = data.roundCnt;
        curRound         = data.curRound;
        matchCntCurRound = data.matchCntCurRound;
        curMatch         = data.curMatch;

        //string tempStr = "Loaded Participants : ";
        //foreach (SpecialAdventurer spAdv in skirmishParticipants)
        //{
        //    tempStr += spAdv.index;
        //    tempStr += " ";
        //}
        //Debug.Log(tempStr);
    }
    public GameSavedata(string sceneNameInput)
    {
        GameManager      gameManager      = GameManager.Instance;
        StructureManager structureManager = StructureManager.Instance;

        sceneName                   = sceneNameInput;
        playerGold                  = gameManager.playerGold;
        playerPopularity            = gameManager.playerPopularity;
        playerSpAdvIndex            = gameManager.playerSpAdvIndex;
        characterDialogProgressData = ProgressManager.Instance.characterDialogProgressData;

        itemStorage = gameManager.GetItemStorage();

        cameraPosition = new Vector3Data(Camera.main.transform.position);
        cameraSize     = Camera.main.orthographicSize;
        Camera.main.GetComponent <InputManager>().isLoading = true;

        combatAreaManager = new CombatAreaManagerData();
        combatAreaManager.InitCombatAreaManagerData();

        #region Actors
        // travelers 저장.
        travelersDisabled = new List <TravelerData>();
        for (int i = 0; i < gameManager.travelersDisabled.Count; i++)
        {
            travelersDisabled.Add(new TravelerData(gameManager.travelersDisabled[i]));
            travelersDisabled[i].index = i;
        }

        travelersEnabled = new List <TravelerData>();
        for (int i = 0; i < gameManager.travelersEnabled.Count; i++)
        {
            travelersEnabled.Add(new TravelerData(gameManager.travelersEnabled[i]));
            travelersEnabled[i].index = i;
        }

        trvEnterQ = new Queue <TravelerData>();
        List <GameObject> trvEnterQConverted = gameManager.trvEnterQ.ToList();
        for (int i = 0; i < trvEnterQConverted.Count; i++)
        {
            trvEnterQ.Enqueue(new TravelerData(trvEnterQConverted[i]));
        }


        adventurersEnabled = new List <AdventurerData>();
        for (int i = 0; i < gameManager.adventurersEnabled.Count; i++)
        {
            adventurersEnabled.Add(new AdventurerData(gameManager.adventurersEnabled[i]));
            // 인덱스 수정해서 넣어주기
            adventurersEnabled[i].index = i;
        }

        adventurersDisabled = new List <AdventurerData>();
        for (int i = 0; i < gameManager.adventurersDisabled.Count; i++)
        {
            adventurersDisabled.Add(new AdventurerData(gameManager.adventurersDisabled[i]));
            adventurersDisabled[i].index = i;
        }

        advEnterQ = new Queue <AdventurerData>();
        List <GameObject> advEnterQConverted = gameManager.advEnterQ.ToList();
        for (int i = 0; i < advEnterQConverted.Count; i++)
        {
            advEnterQ.Enqueue(new AdventurerData(advEnterQConverted[i]));
        }

        specialAdventurers = new List <SpecialAdventurerData>();
        for (int i = 0; i < gameManager.specialAdventurers.Count; i++)
        {
            specialAdventurers.Add(new SpecialAdventurerData(gameManager.specialAdventurers[i]));
        }

        spAdvEnterQ = new Queue <int>();
        List <GameObject> spAdvEnterQConverted = gameManager.spAdvEnterQ.ToList();
        for (int i = 0; i < spAdvEnterQConverted.Count; i++)
        {
            spAdvEnterQ.Enqueue(spAdvEnterQConverted[i].GetComponent <SpecialAdventurer>().index);
        }
        #endregion

        #region BossPhase
        if (gameManager.GetCurSkirmish() != null)
        {
            curSkirmish = new SkirmishData(gameManager.GetCurSkirmish());
        }
        isBossPhase            = gameManager.isBossPhase;
        responsedSpAdvCnt      = gameManager.responsedSpAdvCnt;
        isBossRaidPrepTimeOver = gameManager.isBossRaidPrepTimeOver;
        bossRaidPrepWatiedTime = gameManager.bossRaidPrepWaitedTime;
        retryTimeLeft          = gameManager.retryTimeLeft;
        canCallBossRaid        = gameManager.canCallBossRaid;
        #endregion

        #region UI
        bossRaidUIState   = UIManager.Instance.bossRaidUI.State;
        bossRaidStateText = UIManager.Instance.bossRaidUI.GetRaidStateText();
        #endregion

        // 타일맵 저장.
        tileDatas = new List <TileData>();
        GameObject tileLayer = gameManager.GetTileLayer();

        int tileCount = tileLayer.transform.childCount;

        for (int i = 0; i < tileCount; i++)
        {
            tileDatas.Add(new TileData(tileLayer.transform.GetChild(i).gameObject));
        }

        // 건물 저장.
        structureDatas = new List <StructureData>();

        for (int i = 0; i < structureManager.structures.Count; i++)
        {
            structureDatas.Add(new StructureData(structureManager.structures[i]));
        }
    }