// Use this for initialization void Start() { //turn on certain abilities so I don't have to keep doing it over and over again if (isDoubleJump) { Dialoguer.SetGlobalBoolean(2, true); } }
protected override void onStart() { bool success = false; switch (type) { case VariableEditorTypes.Boolean: success = bool.TryParse(setValue, out _setBool); switch (equation) { case VariableEditorSetEquation.Equals: if (scope == VariableEditorScopes.Local) { _localVariables.booleans[variableId] = _setBool; } else { Dialoguer.SetGlobalBoolean(variableId, _setBool); } break; case VariableEditorSetEquation.Toggle: if (scope == VariableEditorScopes.Local) { _localVariables.booleans[variableId] = !_localVariables.booleans[variableId]; } else { Dialoguer.SetGlobalBoolean(variableId, !Dialoguer.GetGlobalBoolean(variableId)); } success = true; break; } break; case VariableEditorTypes.Float: success = float.TryParse(setValue, out _setFloat); switch (equation) { case VariableEditorSetEquation.Equals: if (scope == VariableEditorScopes.Local) { _localVariables.floats[variableId] = _setFloat; } else { Dialoguer.SetGlobalFloat(variableId, _setFloat); } break; case VariableEditorSetEquation.Add: if (scope == VariableEditorScopes.Local) { _localVariables.floats[variableId] += _setFloat; } else { Dialoguer.SetGlobalFloat(variableId, Dialoguer.GetGlobalFloat(variableId) + _setFloat); } break; case VariableEditorSetEquation.Subtract: if (scope == VariableEditorScopes.Local) { _localVariables.floats[variableId] -= _setFloat; } else { Dialoguer.SetGlobalFloat(variableId, Dialoguer.GetGlobalFloat(variableId) - _setFloat); } break; case VariableEditorSetEquation.Multiply: if (scope == VariableEditorScopes.Local) { _localVariables.floats[variableId] *= _setFloat; } else { Dialoguer.SetGlobalFloat(variableId, Dialoguer.GetGlobalFloat(variableId) * _setFloat); } break; case VariableEditorSetEquation.Divide: if (scope == VariableEditorScopes.Local) { _localVariables.floats[variableId] /= _setFloat; } else { Dialoguer.SetGlobalFloat(variableId, Dialoguer.GetGlobalFloat(variableId) / _setFloat); } break; } break; case VariableEditorTypes.String: success = true; _setString = setValue; switch (equation) { case VariableEditorSetEquation.Equals: if (scope == VariableEditorScopes.Local) { _localVariables.strings[variableId] = _setString; } else { Dialoguer.SetGlobalString(variableId, _setString); } break; case VariableEditorSetEquation.Add: if (scope == VariableEditorScopes.Local) { _localVariables.strings[variableId] += _setString; } else { Dialoguer.SetGlobalString(variableId, Dialoguer.GetGlobalString(variableId) + _setString); } break; } break; } if (!success) { Debug.LogWarning("[SetVariablePhase] Could not parse setValue"); } Continue(0); state = PhaseState.Complete; }
public void LoadGame() { using (ES2Reader reader = ES2Reader.Create("player")) { PlayerInfo.Instance.Data.Level.Value = reader.Read <int>("dengji"); PlayerInfo.Instance.Data.Gold.Value = reader.Read <int>("jinbi"); PlayerInfo.Instance.Data.Experience.Value = reader.Read <int>("jingyan"); PlayerInfo.Instance.Data.Life.Value = reader.Read <int>("shengming"); PlayerInfo.Instance.Data.Attack.Value = reader.Read <int>("gongji"); PlayerInfo.Instance.Data.Defence.Value = reader.Read <int>("fangyu"); PlayerInfo.Instance.Data.KeyYellow.Value = reader.Read <int>("key_yellow"); PlayerInfo.Instance.Data.KeyBlue.Value = reader.Read <int>("key_blue"); PlayerInfo.Instance.Data.KeyRed.Value = reader.Read <int>("key_red"); PlayerInfo.Instance.Data.HandBook.Value = reader.Read <bool>("daoju_tujian"); PlayerInfo.Instance.Data.Fly.Value = reader.Read <bool>("daoju_feixing"); GM.MaxFloor.Value = reader.Read <int>("maxFloor"); Dialoguer.SetGlobalBoolean(0, reader.Read <bool>("hasJinglingTalked")); Dialoguer.SetGlobalBoolean(1, reader.Read <bool>("hasDaozeiTalked")); Dialoguer.SetGlobalBoolean(2, reader.Read <bool>("hasGoodJian")); Dialoguer.SetGlobalBoolean(3, reader.Read <bool>("hasGoodDun")); Dialoguer.SetGlobalBoolean(4, reader.Read <bool>("hasGangJian")); Dialoguer.SetGlobalBoolean(5, reader.Read <bool>("hasGangDun")); } #if UNITY_WP8 for (int i = 0; i < GM.MaxFloor + 1; i++) { GM.floorGO[i].SetActive(true); using (ES2Reader reader = ES2Reader.Create("floor" + i)) { TileSystem ts_object = GameObject.Find("Floor" + i).gameObject.GetComponent <TileSystem>(); for (int x = 0; x < 11; x++) { for (int y = 0; y < 11; y++) { int hasTile = reader.Read <int>(x + "v" + y); if (sceneData[i] == null) { sceneData[i] = new int[11, 11]; } sceneData[i][x, y] = hasTile; if (sceneData[i][x, y] != null && sceneData[i][x, y] == 1) { TileData tile = ts_object.GetTile(x, y); if (tile != null) { GameObject.Destroy(tile.gameObject); tile.Clear(); } } } } } GM.floorGO[i].SetActive(false); } #else for (int i = 0; i < GM.MaxFloor.Value + 1; i++) { GM.floorGO[i].SetActive(true); sceneData[i] = ES2.Load2DArray <int>("floor" + i); TileSystem ts_object = GameObject.Find("Floor" + i).gameObject.GetComponent <TileSystem>(); for (int x = 0; x < 11; x++) { for (int y = 0; y < 11; y++) { if (sceneData[i][x, y] == 1) { TileData tile = ts_object.GetTile(x, y); if (tile != null) { GameObject.Destroy(tile.gameObject); tile.Clear(); } } } } GM.floorGO[i].SetActive(false); } #endif GM.floorGO[0].SetActive(true); DM.state = ""; PlayerPrefs.DeleteKey("loadgame"); DM.tipContent = "读取成功"; DM.tipTime = 3; }