public void SaveData() { string q; if (Id == 0) { BattleCode = Guid.NewGuid(); q = $@"INSERT INTO battles(battle_code) VALUES(CAST('{BattleCode.ToString()}' AS uniqueidentifier)) SELECT @@IDENTITY AS Result"; Id = DataConnection.GetResultInt(q); } q = $@"UPDATE battles SET battle_code = CAST('{BattleCode}' AS uniqueidentifier), player_id = {PlayerId}, ongoing = {Ongoing}, battle_scene_type_id = {BattleSceneTypeId}, rig_id = {RigId}, date_start = {DataConnection.DateToSqlString(DateStart)}, date_complete = {DataConnection.DateToSqlString(DateComplete)}, successfull = {Successfull}, current_cycle = {CurrentCycle}, current_stage = {CurrentStage}, max_opened_cycle = {MaxOpenedCycle}, max_opened_stage = {MaxOpenedStage}, ship_experience = {ShipExperience}, ship_skill_points = {ShipSkillPoints}, ship_next_skill_point_experience = {ShipNextSkillPointExperience}, ship_total_skill_points_received = {ShipTotalSkillPointsReceived}, ship_opened_skills = @str1, module_skills_json_compressed = @str2 WHERE id = {Id}"; List <string> names = new List <string> { ShipOpenedSkills, ModuleSkillsJsonCompressed }; DataConnection.Execute(q, names); }
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); }