Example #1
0
        public void Init()
        {
            try
            {
                GoogleSheetReader sheetReader = new GoogleSheetReader(GameManager.GOOGLESHEET_ID, GameManager.GOOGLESHEET_API_KEY);
                sheetReader.Load("meta_player_stat");

                foreach (GoogleSheetReader.Row row in sheetReader)
                {
                    StatType statType = row.GetEnum <StatType>("stat_type");
                    base_stats.Add(new RandomStatMeta()
                    {
                        type = statType, min_value = row.GetFloat("base_min_value"), max_value = row.GetFloat("base_max_value"), interval = row.GetFloat("base_interval")
                    });
                    levelup_stats.Add(new RandomStatMeta()
                    {
                        type = statType, min_value = row.GetFloat("levelup_min_value"), max_value = row.GetFloat("levelup_max_value"), interval = row.GetFloat("levelup_interval")
                    });
                }
            }
            catch (System.Exception e)
            {
                GameManager.Instance.ui_textbox.on_close = () =>
                {
                    Application.Quit();
                };
                GameManager.Instance.ui_textbox.AsyncWrite("error: " + e.Message + "\n" + e.ToString(), false);
            }
        }
Example #2
0
    public void Init()
    {
        try
        {
            GoogleSheetReader sheetReader = new GoogleSheetReader(GameManager.GOOGLESHEET_ID, GameManager.GOOGLESHEET_API_KEY);
            sheetReader.Load("meta_quest");

            foreach (GoogleSheetReader.Row row in sheetReader)
            {
                Quest quest = new Quest();
                quest.quest_id       = row.GetString("quest_id");
                quest.quest_name     = row.GetString("quest_name");
                quest.sprite_path    = row.GetString("sprite_path");
                quest.reward.coin    = row.GetInt32("reward_coin");
                quest.reward.item_id = row.GetString("reward_item_id");
                quests.Add(quest.quest_id, quest);
            }
        }
        catch (System.Exception e)
        {
            GameManager.Instance.ui_textbox.on_close = () =>
            {
                Application.Quit();
            };
            GameManager.Instance.ui_textbox.AsyncWrite("error: " + e.Message + "\n" + e.ToString(), false);
        }
    }
Example #3
0
    public void Init()
    {
        metas = new Dictionary <string, Monster.Meta>();
        try
        {
            GoogleSheetReader sheetReader = new GoogleSheetReader(GameManager.GOOGLESHEET_ID, GameManager.GOOGLESHEET_API_KEY);
            sheetReader.Load("meta_monster");

            foreach (GoogleSheetReader.Row row in sheetReader)
            {
                Monster.Meta meta = new Monster.Meta();
                meta.id          = row.GetString("monster_id");
                meta.name        = row.GetString("monster_name");
                meta.health      = row.GetFloat("health");
                meta.attack      = row.GetFloat("attack");
                meta.defense     = row.GetFloat("defense");
                meta.speed       = row.GetFloat("speed");
                meta.sprite_path = row.GetString("sprite_path");
                meta.reward.coin = row.GetInt32("reward_coin");
                meta.reward.exp  = row.GetInt32("reward_exp");
                metas.Add(meta.id, meta);
            }
        }
        catch (System.Exception e)
        {
            GameManager.Instance.ui_textbox.on_close = () =>
            {
                Application.Quit();
            };
            GameManager.Instance.ui_textbox.AsyncWrite("error: " + e.Message + "\n" + e.ToString(), false);
        }
    }
Example #4
0
 private bool InitSubStatMeta()
 {
     try
     {
         GoogleSheetReader sheetReader = new GoogleSheetReader(GameManager.GOOGLESHEET_ID, GameManager.GOOGLESHEET_API_KEY);
         sheetReader.Load("meta_item_equip_substat");
         foreach (GoogleSheetReader.Row row in sheetReader)
         {
             EquipItem.Meta meta = ItemManager.Instance.FindMeta <EquipItem.Meta>(row.GetString("item_id"));
             meta.sub_stats.Add(new EquipItemStatMeta()
             {
                 type           = row.GetEnum <StatType>("stat_type"),
                 base_value     = row.GetFloat("base_value"),
                 max_value      = row.GetFloat("max_value"),
                 rand_stat_meta = new RandomStatMeta()
                 {
                     type      = row.GetEnum <StatType>("stat_type"),
                     min_value = row.GetFloat("rand_min_value"),
                     max_value = row.GetFloat("rand_max_value"),
                     interval  = row.GetFloat("interval"),
                 }
             });
         }
     }
     catch (System.Exception e)
     {
         GameManager.Instance.ui_textbox.on_close = () =>
         {
             Application.Quit();
         };
         GameManager.Instance.ui_textbox.AsyncWrite("error: " + e.Message + "\n" + e.ToString(), false);
         return(false);
     }
     return(true);
 }
Example #5
0
 public Row(GoogleSheetReader reader, JSONObject row)
 {
     this.reader = reader;
     values      = new string[row.list.Count];
     for (int i = 0; i < row.list.Count; i++)
     {
         values[i] = row.list[i].str;
     }
 }
Example #6
0
    private bool InitItemMeta()
    {
        try
        {
            GoogleSheetReader sheetReader = new GoogleSheetReader(GameManager.GOOGLESHEET_ID, GameManager.GOOGLESHEET_API_KEY);
            sheetReader.Load("meta_item_equip");
            foreach (GoogleSheetReader.Row row in sheetReader)
            {
                EquipItem.Meta meta = new EquipItem.Meta();
                meta.id        = row.GetString("item_id");
                meta.name      = row.GetString("item_name");
                meta.part      = row.GetEnum <EquipItem.Part>("equip_part");
                meta.price     = row.GetInt32("price");
                meta.weight    = row.GetFloat("weight");
                meta.type      = Item.Type.Equipment;
                meta.main_stat = new EquipItemStatMeta()
                {
                    type           = row.GetEnum <StatType>("main_stat_type"),
                    base_value     = row.GetFloat("main_base_value"),
                    max_value      = 0.0f,
                    rand_stat_meta = new RandomStatMeta()
                    {
                        type      = row.GetEnum <StatType>("main_stat_type"),
                        min_value = 0,
                        max_value = row.GetFloat("main_rand_value"),
                        interval  = 0.01f
                    }
                };

                meta.main_skill = null;
                if ("" != row.GetString("skill_id"))
                {
                    meta.main_skill = SkillManager.Instance.FindMeta <Skill.Meta>(row.GetString("skill_id"));
                }
                meta.sprite_path = row.GetString("sprite_path");
                meta.description = row.GetString("description");

                item_metas[(int)EquipItem.Part.Invalid].Add(meta);
                item_metas[(int)meta.part].Add(meta);
                ItemManager.Instance.AddItemMeta(meta);
            }
        }
        catch (System.Exception e)
        {
            GameManager.Instance.ui_textbox.on_close = () =>
            {
                Application.Quit();
            };
            GameManager.Instance.ui_textbox.AsyncWrite("error: " + e.Message + "\n" + e.ToString(), false);
            return(false);
        }
        return(true);
    }
Example #7
0
 public void Init()
 {
     try
     {
         GoogleSheetReader sheetReader = new GoogleSheetReader(GameManager.GOOGLESHEET_ID, GameManager.GOOGLESHEET_API_KEY);
         sheetReader.Load("meta_stat");
         foreach (GoogleSheetReader.Row row in sheetReader)
         {
             Meta meta = new Meta();
             meta.type        = row.GetEnum <StatType>("stat_type");
             meta.description = row.GetString("description");
             metas.Add(meta.type, meta);
         }
     }
     catch (System.Exception e)
     {
         GameManager.Instance.ui_textbox.on_close = () =>
         {
             Application.Quit();
         };
         GameManager.Instance.ui_textbox.AsyncWrite("error: " + e.Message + "\n" + e.ToString(), false);
     }
 }
Example #8
0
 private bool InitSkillMeta()
 {
     try
     {
         GoogleSheetReader sheetReader = new GoogleSheetReader(GameManager.GOOGLESHEET_ID, GameManager.GOOGLESHEET_API_KEY);
         sheetReader.Load("meta_item_equip_skill");
         foreach (GoogleSheetReader.Row row in sheetReader)
         {
             EquipItem.Meta meta = ItemManager.Instance.FindMeta <EquipItem.Meta>(row.GetString("item_id"));
             meta.rand_skill.Add(SkillManager.Instance.FindMeta <Skill.Meta>(row.GetString("skill_id")));
         }
     }
     catch (System.Exception e)
     {
         GameManager.Instance.ui_textbox.on_close = () =>
         {
             Application.Quit();
         };
         GameManager.Instance.ui_textbox.AsyncWrite("error: " + e.Message + "\n" + e.ToString(), false);
         return(false);
     }
     return(true);
 }
Example #9
0
    IEnumerator DoActionGetInfo()
    {
        GoogleSheetReader _googleSheetReader = new GoogleSheetReader(googleSheetAppID, spreadSheetID);

        Debug.Log("Load Key Localize From Google!!!");
        yield return(_googleSheetReader.Load(fromCell, toCell, sheetID));

        var _value = _googleSheetReader.GetValues();

        Debug.Log("Start Load Key: " + _googleSheetReader.rawResult);
        listDetail = new List <string>();
        for (int i = 0; i < _value.Count; i++)
        {
            for (int j = 0; j < _value[i].Count; j++)
            {
                string _tmp = _value[i][j].Value;
                if (string.IsNullOrEmpty(_tmp))
                {
                    Debug.LogError("Bug : i = " + i + " + j = " + j);
                    yield break;
                }
                if (_tmp.Equals("NULL"))
                {
                    listDetail.Add(string.Empty);
                    continue;
                }
                // _tmp = _tmp.ToLower();
                _tmp = _tmp.TrimStart();
                _tmp = _tmp.TrimEnd();
                // _tmp = _tmp.Replace("%", string.Empty);
                listDetail.Add(_tmp);
            }
        }

        if (listDetail == null || listDetail.Count == 0)
        {
            Debug.Log("listDetail is null!!!");
            yield break;
        }

        myListLocalizeInfo.localize_En.store = StringStringDictionary.New <StringStringDictionary>();

        for (int i = 0; i < listDetail.Count; i++)
        {
            string[] _fields = listDetail[i].Split('#');
            if (_fields == null || _fields.Length == 0)
            {
                continue;
            }
            string _nameSheet = _fields[0];
            for (int j = 1; j < _fields.Length; j++)
            {
                if (string.IsNullOrEmpty(_fields[j]))
                {
                    Debug.LogWarning("Skip At Index : " + i + " with detail : " + j);
                    break;
                }
                string[] _fields_01 = _fields[j].Split(';');
                if (_fields_01 == null || _fields_01.Length == 0)
                {
                    continue;
                }
                string _key     = _fields_01[0];
                string _valueEN = _fields_01[1];
                myListLocalizeInfo.localize_En.store.dictionary.Add(_nameSheet + "/" + _key, _valueEN);
            }
        }

        UnityEditor.EditorUtility.SetDirty(myListLocalizeInfo.localize_En);

        Debug.Log("Completed!!!");
    }