//----------------------------------- //----------------------------------- //----------------------------------- public static MagicalTroop ParseToMagicalTroop(StrongString theString) { StrongString[] myStrings = theString.Split(InCharSeparator); MagicalTroop myMagicalTroop = new MagicalTroop(Unit.ConvertToUnit(myStrings[0]), myStrings[1].ToUInt16(), Unit.ConvertToUnit(myStrings[2])); return(myMagicalTroop); }
public static StrongString GetForServer(MagicalTroop troops) { StrongString myString = troops.Count.GetForServer() + InCharSeparator + troops.Level.ToString() + InCharSeparator + troops.Power.GetForServer() + InCharSeparator; return(myString); }
/// <summary> /// Create player's troops for the first time. /// </summary> /// <param name="troops"></param> public async static Task <DataBaseDataChangedInfo> CreatePlayerMagicalTroops(MagicalTroop troops) { StrongString myString = GetForServer(troops); string targetFile = ThereIsServer.GameObjects.MyProfile.Username + EndFileName; return(await ThereIsServer.Actions.CreateFile(ThereIsServer.ServersInfo.MyServers[0], targetFile, new DataBaseCreation("CreatingThePlayerSoldiers", QString.Parse(myString)))); }
/// <summary> /// Create player's troops for the first time. /// </summary> /// <param name="troops"></param> public static async Task <DataBaseDataChangedInfo> CreatePlayerMagicalTroops(MagicalTroop troops) { StrongString myString = GetForServer(troops); //--------------------------------------------- var _me = ThereIsServer.GameObjects.MyProfile; var _target = _me.UID.GetValue() + MT_Server_LOC; var _s = ThereIsServer.ServersInfo.ServerManager.Get_MagicalTroops_Server(_me.Socket); var _req = new DataBaseCreation(MTROOPS_MESSAGE, QString.Parse(myString)); return(await ThereIsServer.Actions.CreateData(_s, _target, _req)); //--------------------------------------------- }
/// <summary> /// Save Player's troops(Update them to the server.) /// </summary> /// <param name="troops"></param> public async static void SavePlayerTroops(MagicalTroop troops) { StrongString myString = GetForServer(troops); string targetFile = ThereIsServer.GameObjects.MyProfile.Username + EndFileName; var ExistingFile = await ThereIsServer.Actions.GetAllContentsByRef(ThereIsServer.ServersInfo.MyServers[0], targetFile); if (ExistingFile.IsDeadCallBack || ThereIsServer.ServerSettings.HasConnectionClosed) { NoInternetConnectionSandBox.PrepareConnectionClosedSandBox(); return; } await ThereIsServer.Actions.UpdateFile(ThereIsServer.ServersInfo.MyServers[0], targetFile, new DataBaseUpdateRequest("By SAO", QString.Parse(myString), ExistingFile.Sha)); }
/// <summary> /// Save Player's troops(Update them to the server.) /// </summary> /// <param name="troops"></param> public static async void SavePlayerTroops(MagicalTroop troops) { StrongString myString = GetForServer(troops); //--------------------------------------------- var _p = ThereIsServer.GameObjects.MyProfile; var _s = ThereIsServer.ServersInfo.ServerManager.Get_MagicalTroops_Server(_p.Socket); var _target = _p.UID.GetValue() + MT_Server_LOC; var existing = await ThereIsServer.Actions.GetAllContentsByRef(_s, _target); //--------------------------------------------- if (existing.IsDeadCallBack || ThereIsServer.ServerSettings.HasConnectionClosed) { NoInternetConnectionSandBox.PrepareConnectionClosedSandBox(); return; } //--------------------------------------------- var _req = new DataBaseUpdateRequest(MTROOPS_MESSAGE, QString.Parse(myString), existing.Sha); await ThereIsServer.Actions.UpdateData(_s, _target, _req); //--------------------------------------------- }