EnemySetData GetEnemySet(TextCovertedData data) { var db = SaveDataController.Instance.GetDB_static <EnemySetDB>(); var dbdata = db.GetDataList().Where(x => x._Data._serchId == data._data).First() as EnemySetDBData; return(dbdata._enemySetData); }
public BranchCode(TextCovertedData data) { _selectList = GetSelectList(data); _nextCodes = new Queue <CodeData> [_selectList.Count]; for (int i = 0; i < _nextCodes.Length; i++) { _nextCodes[i] = new Queue <CodeData>(); } }
List <string> GetSelectList(TextCovertedData data) { var result = new List <string>(); var codes = data._text.Split('\n'); foreach (var code in codes) { result.Add(code); } return(result); }
public LoadCode(TextCovertedData data) { if (data._data == "black") { toBlack = true; } else if (data._data == "clear") { toBlack = false; } }
public AudioCode(TextCovertedData data) { if (data._data == "reset") { _reset = true; } else { _soundeKey = data._data; _soundIndex = int.Parse(data._text); } }
public ShopCode(TextCovertedData data) { var db = SaveDataController.Instance.GetDB_static <ShopDB>()._dataList; try { myShopData = db.Where(x => x._serchId == data._data).First(); }catch (System.NullReferenceException e) { Debug.LogError($"shop name is not exist:key={data._data}\n{e}"); } }
public SkillCode(TextCovertedData data) { var input = data._data.Split(','); var playerId = input[0]; var skillid = input[1]; var db_player = SaveDataController.Instance.GetDB_var <PlayerDB, SavedDBData_player>(); targetPlayer = db_player.Where(x => x._serchId == playerId).First(); var db_skill = SaveDataController.Instance.GetDB_static <SkillDB>()._dataList; targetSkill = db_skill.Where(x => x._serchId == skillid).First(); }
Dictionary <string, int> SetItemSet(TextCovertedData data) { var result = new Dictionary <string, int>(); var texts = data._text.Split('\n'); result.Add(data._data, int.Parse(texts[0])); for (int i = 1; i < texts.Length; i++) { var text = texts[i].Split(' '); try { result.Add(text[0], int.Parse(text[1])); }catch (System.IndexOutOfRangeException) { } } return(result); }
public ImageCode(TextCovertedData data) { if (data._data == "reset") { reset = true; _imagePos = GetImagePos(data._text.Trim()); } else { var d = data._data.Split(','); setName = d[0]; number = int.Parse(d[1]); var text = data._text.Split(' '); _imagePos = GetImagePos(text[0].Trim()); if (text.Length >= 2) { _imageDirection = GetImageDir(text[1].Trim()); } } }
public override bool CheckChain(TextCovertedData data) { if (string.IsNullOrEmpty(data._head)) { return(false); } var head = data._head.Substring(0, 1); if (int.TryParse(head, out int select)) { var newData = new TextCovertedData(data._head.Substring(1), data._data, data._text); var next = new EndCode().CreateCodeData(newData, this._targetScr); if (!_nextCodes[select - 1].Contains(next)) { _nextCodes[select - 1].Enqueue(next); } return(true); } return(false); }
public BattleCode(TextCovertedData data) { _targetEnemySet = GetEnemySet(data); }
public override bool CheckChain(TextCovertedData data) { return(false); }
public WaitCode(TextCovertedData data) { waitTime = int.Parse(data._data) / 100f; }
public ItemCode(TextCovertedData data) { _itemSet = SetItemSet(data); }
public MapCode(TextCovertedData data) { mapName = data._data; }
public FlagCode(TextCovertedData data) { _flagData = GetFlag(data); }
public CodeData CreateCodeData(TextCovertedData data, EventCodeScriptable scr) { if (data == null) { return(new EndCode()); } if (CheckChain(data)) { return(this); } CodeData result = null; switch (data._head) { case "": case "name": //name[name] result = new TextData(data); break; case "branch": //branch \nbranchName \n $#1... result = new BranchCode(data); break; case "flag": //flag[flagName] 5 result = new FlagCode(data); break; case "item": //item[itemName] 1 result = new ItemCode(data); break; case "map": //map[mapName] result = new MapCode(data); break; case "image": //image[setName,num] back (center) result = new ImageCode(data); break; case "music": //music[setName,0] result = new AudioCode(data); break; case "battle": //battle[enemySetName] result = new BattleCode(data); break; case "load": //load[black] 500 result = new LoadCode(data); break; case "wait": //wait[500] result = new WaitCode(data); break; default: return(null); } result._targetScr = scr; return(result); }
//次のデータが吸収できるデータなら吸収する public virtual bool CheckChain(TextCovertedData data) { return(false); }