Example #1
0
    private void Awake()
    {
        var text = AssetBundleContainer.LoadAsset <TextAsset>("jsons", "ShopKeepperTable");

        if (text == null)
        {
            AssetBundle result = AssetBundleContainer.LoadFromFile(Path.Combine(Application.streamingAssetsPath, "jsons"));

            text = result.LoadAsset <TextAsset>("ShopKeepperTable");
        }

        //TODO: 본 게임에 들어갈때 삭제 할 코드
        //ItemContainer.CreateItem();

        Data = JsonManager.LoadJson <Serialization <string, ShopKeepperData> >(text).ToDictionary()[ID];

        _ShopCanvas = GetComponentInChildren <ShopCanvas>();

        nameText.text = Data.NPCName;

        List <int> copyItemID = new List <int>(Data.ItemID);

        _ShopCanvas.LinkingItems(copyItemID);

        _ShopCanvas.CloseCanvas();
    }
Example #2
0
    private void LoadToJsonData(int ID)
    {
        //테이블 ID는 1부터 시작
        //ID가 기본값이면 에러로그 출력
        AssetBundle localAssetBundle = AssetBundleContainer.LoadFromFile(Path.Combine(Application.streamingAssetsPath, "jsons"));

        if (localAssetBundle == null)
        {
            Log.PrintError("Failed to load AssetBundle!");
        }

        if (ID == 0)
        {
            Log.PrintError("Failed to Player Data, ID is null or 0");
            return;
        }

        TextAsset json = localAssetBundle.LoadAsset <TextAsset>("Characters_Table");

        //Json 파싱
        var playerDatas = JsonManager.LoadJson <Serialization <string, PlayerData> >(json).ToDictionary();

        //ID 값으로 해당되는 Data 저장
        //ID는 각 몬스터 스크립트에서 할당
        playerData = playerDatas[ID.ToString()];
    }
Example #3
0
        private bool LoadToJsonData(int ID)
        {
            Log.Print("Monster: Load JsonData to Monster ID");
            //Json 파싱
            AssetBundle localAssetBundle = AssetBundleContainer.LoadFromFile(Path.Combine(Application.streamingAssetsPath, "jsons"));

            if (localAssetBundle == null)
            {
                Log.PrintError("LoadToJosnData: Failed to load AssetBundle!");
                return(false);
            }
            TextAsset monsterTable = localAssetBundle.LoadAsset <TextAsset>("MonsterTable");

            var json = JsonManager.LoadJson <Serialization <string, MonsterDataTable> >(monsterTable).ToDictionary();

            //데이터에 몬스터에 해당하는 키가 없으면 return
            if (json.ContainsKey(ID.ToString()) == false)
            {
                Log.PrintError("Failed to Monster Data. ID is null or 0");
                return(false);
            }

            dataTable = json[ID.ToString()];
            return(true);
        }
Example #4
0
    private void LoadMapDatas()
    {
        AssetBundle result = AssetBundleContainer.LoadFromFile(Path.Combine(Application.streamingAssetsPath, "jsons"));

        if (result == null)
        {
            Log.PrintError("Failed to Load Jsons");
        }

        CurrentLoadCount++;
    }
Example #5
0
    private void Awake()
    {
        var text = AssetBundleContainer.LoadAsset <TextAsset>("jsons", "NPCTable");

        if (text == null)
        {
            AssetBundle result = AssetBundleContainer.LoadFromFile(Path.Combine(Application.streamingAssetsPath, "jsons"));

            text = result.LoadAsset <TextAsset>("NPCTable");
        }
        var data = JsonManager.LoadJson <Serialization <string, NPCDataTable> >(text).ToDictionary();

        Texts    = data[ID].Text.Split('\n');
        nameText = data[ID].NpcName;

        conversationCanvas.Initialize();
    }