private void btnSave_Click(object sender, EventArgs e) { ABCWaitingDialog.Show("", "Saving . . .!"); STEnumDefinesController ctrl = new STEnumDefinesController(); foreach (DataRow dr in ((DataTable)this.gridControl1.DataSource).Rows) { STEnumDefinesInfo info = (STEnumDefinesInfo)ctrl.GetObjectFromDataRow(dr); if (info != null) { if (info.STEnumDefineID != Guid.Empty) { ctrl.UpdateObject(info); } else { ctrl.CreateObject(info); } } } InvalidateData(); EnumProvider.GetAllEnums(); ABCWaitingDialog.Close(); }
public virtual void Login(EnumProvider pro) { #if UNITY_IOS && ENABLE_GAME_CENTER Social.localUser.Authenticate((bool success) => { // handle success or failure isSignedIn = success; if (success) { var id = ""; var name = ""; try { id = Social.localUser.id; name = Social.localUser.userName; } catch (Exception ex) { Debug.LogError("Game Center Exception: " + ex); } loginCallback?.Invoke(EnumLoginState.Success, new SocialUser { uid = id, userName = name, }); } else { loginCallback?.Invoke(EnumLoginState.Error, null); } }); #endif }
public virtual void Login(EnumProvider provider) { #if UNITY_ANDROID && ENABLE_GOOGLE_PLAY Debug.Log($"{DefineContain.DebugGoogle} Login with google play game"); Social.localUser.Authenticate((bool success) => { isSignedIn = success; if (isSignedIn) { Debug.Log($"{DefineContain.DebugGoogle} Login success {Social.localUser.id}"); loginCallback?.Invoke(EnumLoginState.Success, new SocialUser { uid = Social.localUser.id, userName = Social.localUser.userName, code = PlayGamesPlatform.Instance.GetServerAuthCode(), }); } else { Debug.LogError($"{DefineContain.DebugGoogle} Login error"); loginCallback?.Invoke(EnumLoginState.Error, null); } }); #endif }
public virtual void Initialize(Action <EnumLoginState, SocialUser> callback) { signedIn = false; loginCallback = callback; currentProvider = EnumProvider.None; auth = FirebaseAuth.DefaultInstance; auth.StateChanged += AuthStateChanged; AuthStateChanged(this, null); }
public OrderChunk(EnumProvider.ORDERSLIST order,Vector3 point,int priorityAndOrID) { this.order = order; floats = new float[3]; floats[0] = point.x; floats[1] = point.y; floats[2] = point.z; data = priorityAndOrID; }
public virtual void Login(EnumProvider provider) { #if ENABLE_FACEBOOK if (!FB.IsLoggedIn) { FB.LogInWithReadPermissions(loginPermission, AuthCallback); } #endif }
private static DbContextOptions <DbContext> GetOptions(EnumProvider provider, string connectionString = null, DbContextOptions <DbContext> dbContextOptions = null) { if (string.IsNullOrEmpty(connectionString) && dbContextOptions != null || (provider == EnumProvider.Unknown && dbContextOptions != null)) { return(dbContextOptions); } else { if (string.IsNullOrEmpty(connectionString) && provider == EnumProvider.SQLite) { connectionString = $"Data Source={Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "SQLite.db")}"; } if (string.IsNullOrEmpty(connectionString) && (provider == EnumProvider.InMemory || provider == EnumProvider.Unknown)) { connectionString = "InMemoryDataBase"; } if (string.IsNullOrEmpty(connectionString)) { throw new ArgumentNullException(nameof(connectionString), "Não existe uma conexão."); } DbContextOptions <DbContext> _dbContextOptions; switch (provider) { case EnumProvider.MySQL: _dbContextOptions = dbContextOptions != null ? new DbContextOptionsBuilder <DbContext>(dbContextOptions).UseMySql(connectionString).Options : new DbContextOptionsBuilder <DbContext>().UseMySql(connectionString).Options; break; case EnumProvider.SQLServer: _dbContextOptions = dbContextOptions != null ? new DbContextOptionsBuilder <DbContext>(dbContextOptions).UseSqlServer(connectionString).Options : new DbContextOptionsBuilder <DbContext>().UseSqlServer(connectionString).Options; break; case EnumProvider.SQLite: _dbContextOptions = dbContextOptions != null ? new DbContextOptionsBuilder <DbContext>(dbContextOptions).UseSqlite(connectionString).Options : new DbContextOptionsBuilder <DbContext>().UseSqlite(connectionString).Options; break; case EnumProvider.PostgreSQL: _dbContextOptions = dbContextOptions != null ? new DbContextOptionsBuilder <DbContext>(dbContextOptions).UseNpgsql(connectionString).Options : new DbContextOptionsBuilder <DbContext>().UseNpgsql(connectionString).Options; break; case EnumProvider.InMemory: _dbContextOptions = dbContextOptions != null ? new DbContextOptionsBuilder <DbContext>(dbContextOptions).UseInMemoryDatabase(connectionString).Options : new DbContextOptionsBuilder <DbContext>().UseInMemoryDatabase(connectionString).Options; break; default: _dbContextOptions = dbContextOptions != null ? new DbContextOptionsBuilder <DbContext>(dbContextOptions).UseInMemoryDatabase(connectionString).Options : new DbContextOptionsBuilder <DbContext>().UseInMemoryDatabase(connectionString).Options; break; } return(_dbContextOptions); } }
public virtual void Login(EnumProvider provider) { #if ENABLE_FIREBASE Debug.Log("LoginFirebase with: " + provider); if (currentProvider != EnumProvider.None && currentProvider != provider || (signedIn && currentProvider != provider)) { Logout(); } if (signedIn && (currentProvider == provider || currentProvider == EnumProvider.None)) { currentProvider = provider; try { loginCallback?.Invoke(EnumLoginState.Success, CopyToSocialUser(user)); } catch (Exception ex) { Debug.LogError("LoginFirebase error: " + ex); loginCallback(EnumLoginState.Error, null); } } else { currentProvider = provider; switch (provider) { case EnumProvider.Facebook: AuthenticationWithFacebook(); break; case EnumProvider.GooglePlay: AuthenticationWithGooglePlay(); break; case EnumProvider.GameCenter: AuthenticationWithGameCenter(); break; case EnumProvider.Email: AuthenticationWithEmailPassword(); break; case EnumProvider.Firebase: break; } } #endif }
protected override EnumProvider.ORDERSLIST on_UnitStateChange(EnumProvider.ORDERSLIST stateorder) { //Debug.Log("OnUnitStateChange called!!!!!!!!!!!!!!!"); movingUnitState = (OPTIONS)stateorder; if (!UNIT.Options.standardOrder) { if (System.Enum.IsDefined(typeof(OPTIONS), (int)stateorder)) { switch (movingUnitState) { case OPTIONS.MoveTo: SetKinematic(); WayPoints.Clear(); UNIT.InteractingUnits.Clear(); UNIT.Options.LockOnFocus(); return stateorder; case OPTIONS.Patrol: SetKinematic(); UNIT.InteractingUnits.Clear(); UNIT.Options.LockOnFocus(); return stateorder; case OPTIONS.Guard: SetKinematic(); WayPoints.Clear(); UNIT.InteractingUnits.Clear(); UNIT.Options.LockOnFocus(); return stateorder; case OPTIONS.Hide: WayPoints.Clear(); SetKinematic(); //todo:----------------- return stateorder; case OPTIONS.Stay: SetKinematic(); WayPoints.Clear(); MoveToPoint = gameObject.transform.position; MovingDirection = MoveToPoint; UNIT.InteractingUnits.Clear(); return stateorder; } } } return stateorder; }
protected override EnumProvider.ORDERSLIST on_UnitStateChange(EnumProvider.ORDERSLIST stateorder) { attackState = (OPTIONS)stateorder; if (!UNIT.Options.standardOrder) { if (System.Enum.IsDefined(typeof(OPTIONS), (int)stateorder)) { switch (attackState) { case OPTIONS.Attack: if (!UNIT.IsABuilding) { this.GetComponent<Movability>().SetKinematic(); this.GetComponent<Movability>().WayPoints.Clear(); UNIT.Options.MoveToPoint = this.gameObject.transform.position; this.GetComponent<Movability>().IsMoving = false; } Debug.Log("ATTACKE!!!"); UNIT.Options.LockOnFocus(); return stateorder; case OPTIONS.Conquer: if (!GetComponent<Gunner>()) this.gameObject.AddComponent<Gunner>(); UNIT.Options.UnitState = EnumProvider.ORDERSLIST.Stay; if (!UNIT.IsABuilding) UNIT.Options.LockOnFocus(); GetComponent<Gunner>().FireAtWill = true; return stateorder; case OPTIONS.Seek: if (!GetComponent<Gunner>()) this.gameObject.AddComponent<Gunner>(); return stateorder; } } } return stateorder; }
public void TryGet() { var provider = new EnumProvider(new MessagePackProvider(), MessagePackContext.Empty); bool result0 = provider.TryGet(typeof(EnumByte), out IMessagePackFormatter formatter0); bool result1 = provider.TryGet(typeof(EnumSByte), out IMessagePackFormatter formatter1); bool result2 = provider.TryGet(typeof(EnumInt16), out IMessagePackFormatter formatter2); bool result3 = provider.TryGet(typeof(EnumInt32), out IMessagePackFormatter formatter3); bool result4 = provider.TryGet(typeof(EnumInt64), out IMessagePackFormatter formatter4); bool result5 = provider.TryGet(typeof(EnumUInt16), out IMessagePackFormatter formatter5); bool result6 = provider.TryGet(typeof(EnumUInt32), out IMessagePackFormatter formatter6); bool result7 = provider.TryGet(typeof(EnumUInt64), out IMessagePackFormatter formatter7); Assert.True(result0); Assert.True(result1); Assert.True(result2); Assert.True(result3); Assert.True(result4); Assert.True(result5); Assert.True(result6); Assert.True(result7); Assert.NotNull(formatter0); Assert.NotNull(formatter1); Assert.NotNull(formatter2); Assert.NotNull(formatter3); Assert.NotNull(formatter4); Assert.NotNull(formatter5); Assert.NotNull(formatter6); Assert.NotNull(formatter7); Assert.IsAssignableFrom <EnumFormatterByte <EnumByte> >(formatter0); Assert.IsAssignableFrom <EnumFormatterSByte <EnumSByte> >(formatter1); Assert.IsAssignableFrom <EnumFormatterInt16 <EnumInt16> >(formatter2); Assert.IsAssignableFrom <EnumFormatterInt32 <EnumInt32> >(formatter3); Assert.IsAssignableFrom <EnumFormatterInt64 <EnumInt64> >(formatter4); Assert.IsAssignableFrom <EnumFormatterUInt16 <EnumUInt16> >(formatter5); Assert.IsAssignableFrom <EnumFormatterUInt32 <EnumUInt32> >(formatter6); Assert.IsAssignableFrom <EnumFormatterUInt64 <EnumUInt64> >(formatter7); }
private ISqlProvider GetProvider(EnumProvider provider) { ISqlProvider rt; switch (provider) { case EnumProvider.SQLServer: rt = new Providers.SQLServer(_options.ConnectionString); break; case EnumProvider.MySQL: rt = new Providers.MySQL(_options.ConnectionString); break; case EnumProvider.SQLite: rt = new Providers.SQLite(_options.ConnectionString); break; case EnumProvider.PostgreSQL: rt = new Providers.PostGreSql(_options.ConnectionString); break; case EnumProvider.Oracle: rt = new Providers.Oracle(_options.ConnectionString); break; case EnumProvider.Unknown: throw new Exception("Unknown Provider"); default: rt = new Providers.SQLite(_options.ConnectionString); break; } return(rt); }
private static DbContextOptions <GolContext> GetOptions(EnumProvider provider, string connectionString = null, DbContextOptions <GolContext> dbContextOptions = null) { if (string.IsNullOrEmpty(connectionString) && dbContextOptions != null) { return(dbContextOptions); } else { if (string.IsNullOrEmpty(connectionString) && provider == EnumProvider.InMemory) { connectionString = "InMemoryDataBase"; } if (string.IsNullOrEmpty(connectionString)) { throw new ArgumentNullException(nameof(connectionString), "Não existe uma conexão."); } DbContextOptions <GolContext> _dbContextOptions; switch (provider) { case EnumProvider.SQLServer: _dbContextOptions = dbContextOptions != null ? new DbContextOptionsBuilder <GolContext>(dbContextOptions).UseSqlServer <GolContext>(connectionString).Options : new DbContextOptionsBuilder <GolContext>().UseSqlServer <GolContext>(connectionString).Options; break; case EnumProvider.InMemory: _dbContextOptions = dbContextOptions != null ? new DbContextOptionsBuilder <GolContext>(dbContextOptions).UseInMemoryDatabase <GolContext>(connectionString).Options : new DbContextOptionsBuilder <GolContext>().UseInMemoryDatabase <GolContext>(connectionString).Options; break; default: _dbContextOptions = dbContextOptions != null ? new DbContextOptionsBuilder <GolContext>(dbContextOptions).UseInMemoryDatabase <GolContext>(connectionString).Options : new DbContextOptionsBuilder <GolContext>().UseInMemoryDatabase <GolContext>(connectionString).Options; break; } return(_dbContextOptions); } }
public virtual void Login(EnumProvider provider) { loginCallback?.Invoke(EnumLoginState.Success, credentialUser); }
protected override EnumProvider.ORDERSLIST on_UnitStateChange(EnumProvider.ORDERSLIST stateorder) { return stateorder; }
public void MenuItemCallback(string solutionFullName, bool regenerate = false, bool loadFromDatabase = false) { Entity entity; try { entity = DetectInformationOfProject(solutionFullName); EnumProvider.SetSolutionPathForEnums(Path.GetDirectoryName(solutionFullName) + "\\src"); EntityProvider.SetSolutionPathForEntities(Path.GetDirectoryName(solutionFullName) + "\\src\\" + entity.Namespace + ".Core"); DbContextProvider.SetSolutionPathForDbContexts(Path.GetDirectoryName(solutionFullName) + "\\src\\" + entity.Namespace + ".EntityFrameworkCore"); AppSettings.PowerToolsDirectoryName = "AspNetZeroRadTool"; } catch (Exception ex) { MsgBox.Exception("Couldn't load information of your ASP.NET Zero project!", ex); return; } try { if (regenerate) { using (JsonEntityForm jsonEntityForm = new JsonEntityForm(Path.GetDirectoryName(solutionFullName))) { if (jsonEntityForm.ShowDialog() != DialogResult.OK) { return; } entity = EntityLoaderFromJson.Build( File.ReadAllText(Path.GetDirectoryName(solutionFullName) + "\\AspNetZeroRadTool\\" + jsonEntityForm.SelectedFile + ".json"), entity); } } else if (loadFromDatabase) { using (DbTableSelectionForm tableSelectionForm = new DbTableSelectionForm(Path.GetDirectoryName(solutionFullName), entity)) { if (tableSelectionForm.ShowDialog() != DialogResult.OK) { return; } entity = tableSelectionForm.SelectedTable; } } } catch (Exception ex) { MsgBox.Exception("Couldn't load information of the entity!", ex); return; } try { var form = new EntityGeneratorForm(entity); try { if (MultiTenancyChecker.IsEnabled(entity)) { return; } form.AllowNoneMultiTenancy = true; } catch (Exception ex) { MsgBox.Exception("Cannot determine multi-tenancy !", ex); } form.Show(); } catch (Exception ex) { MsgBox.Exception("Encountered a fatal error!", ex); } }
public override void MappingData(EnumProvider providerCheck, string authenID, string localGameID, GameMapID gameMaps, Action <EnumMappingState, SocialMapID, GameMapID> callback) { Debug.Log($"{DefineContain.DebugMapping} Mapping: authenID:{authenID} - gameID:{localGameID} - GameIDMap:{JsonUtility.ToJson(gameMaps, true)}"); GetAuthenticationMap(authenID, (checkAuthenState, outSocialMap) => { Debug.Log($"{DefineContain.DebugMapping} stateGetAuthen: {checkAuthenState}"); if (checkAuthenState == EnumDataState.NoData) { GetGameIdMap(localGameID, (checkGameState, gameIDs) => { Debug.Log($"{DefineContain.DebugMapping} checkGameState: {checkGameState}"); if (checkGameState == EnumDataState.NoData) { Debug.Log($"{DefineContain.DebugMapping} no data create new user data"); // 0 - 0 callback?.Invoke(EnumMappingState.CreateNewData, new SocialMapIDEX(localGameID), gameMaps); } else if (checkGameState == EnumDataState.Exists) { // 0 - 1 var outGameId = (GameMapIDEX)gameIDs; var success = true; var cloudId = ""; switch (providerCheck) { case EnumProvider.Email: if (string.IsNullOrEmpty(outGameId.authEmail)) { outGameId.authEmail = authenID; } else { success = false; } break; case EnumProvider.Facebook: if (string.IsNullOrEmpty(outGameId.authFacebook)) { outGameId.authFacebook = authenID; } else { success = false; } break; case EnumProvider.GooglePlay: if (string.IsNullOrEmpty(outGameId.authGooglePlay)) { outGameId.authGooglePlay = authenID; } else { success = false; } break; case EnumProvider.GameCenter: if (string.IsNullOrEmpty(outGameId.authGameCenter)) { outGameId.authGameCenter = authenID; } else { success = false; } break; case EnumProvider.Guest: if (string.IsNullOrEmpty(outGameId.authGuest)) { outGameId.authGuest = authenID; } else { success = false; } break; } if (success) { Debug.Log($"{DefineContain.DebugMapping} not AuthenID - exits game ID"); callback?.Invoke(EnumMappingState.NoDataAuthen_ExitsGameId, new SocialMapIDEX(localGameID), outGameId); } else { Debug.Log($"{DefineContain.DebugMapping} not AuthenID - not match game ID"); callback?.Invoke(EnumMappingState.NoDataAuthen_NoMatchGameId, new SocialMapIDEX(localGameID), outGameId); } } else if (checkGameState == EnumDataState.Error) { Debug.Log($"{DefineContain.DebugMapping} mapping data error"); callback?.Invoke(EnumMappingState.Error, new SocialMapIDEX(localGameID), gameMaps); } }); } else if (checkAuthenState == EnumDataState.Exists) { GetGameIdMap(localGameID, (checkGameState, gameIDs) => { Debug.Log($"{DefineContain.DebugMapping} checkGameState: {checkGameState}"); // 1 - 0 if (checkGameState == EnumDataState.NoData) { Debug.Log($"{DefineContain.DebugMapping} exists AuthenID:{authenID} - no data GameID{outSocialMap.ToDataString()}"); callback?.Invoke(EnumMappingState.ExitsAuthen_NoDataGameID, new SocialMapIDEX(localGameID), gameMaps); } else if (checkGameState == EnumDataState.Exists) { var outGameId = (GameMapIDEX)gameIDs; Debug.Log($"{DefineContain.DebugMapping} game mapping date: {outGameId.ToDataString()}"); // 1 - 1 var success = false; var cloudID = ""; switch (providerCheck) { case EnumProvider.Facebook: cloudID = outGameId.authFacebook; if (authenID.Equals(outGameId.authFacebook) || string.IsNullOrEmpty(outGameId.authFacebook)) { success = true; } break; case EnumProvider.GooglePlay: cloudID = outGameId.authGooglePlay; if (authenID.Equals(outGameId.authGooglePlay) || string.IsNullOrEmpty(outGameId.authGooglePlay)) { success = true; } break; case EnumProvider.GameCenter: cloudID = outGameId.authGameCenter; if (authenID.Equals(outGameId.authGameCenter) || string.IsNullOrEmpty(outGameId.authGameCenter)) { success = true; } break; case EnumProvider.Email: cloudID = outGameId.authEmail; if (authenID.Equals(outGameId.authEmail) || string.IsNullOrEmpty(outGameId.authEmail)) { success = true; } break; case EnumProvider.Guest: cloudID = outGameId.authGuest; if (authenID.Equals(outGameId.authGuest) || string.IsNullOrEmpty(outGameId.authGuest)) { success = true; } break; } if (success) { Debug.Log($"{DefineContain.DebugMapping} mapping date success"); callback?.Invoke(EnumMappingState.Success, outSocialMap, gameIDs); } else { Debug.Log($"{DefineContain.DebugMapping} have 2 Authen connect 1 game id: local:{authenID} - cloud: {cloudID}"); callback?.Invoke(EnumMappingState.TwoAuthenOneGameID, outSocialMap, gameIDs); } } else if (checkGameState == EnumDataState.Error) { Debug.Log($"{DefineContain.DebugMapping} mapping data error"); callback?.Invoke(EnumMappingState.Error, new SocialMapIDEX(localGameID), gameMaps); } }); } else if (checkAuthenState == EnumDataState.Error) { Debug.Log($"{DefineContain.DebugMapping} mapping data error"); callback?.Invoke(EnumMappingState.Error, new SocialMapIDEX(localGameID), gameMaps); } }); }
public void OnButtonEmail() { provider = EnumProvider.Email; text = $"Platform: {provider}"; loginEmail.Login(provider); }
public void OnButtonFacebook() { provider = EnumProvider.Facebook; text = $"Platform: {provider}"; loginFacebook.Login(provider); }
public GolContext(EnumProvider provider, string connectionString = null) : base(GetOptions(provider, connectionString)) { Provider = provider; ConnectionString = connectionString; EnsureCreated(); }
public void GiveChainedOrder(EnumProvider.ORDERSLIST[] orders) { foreach (EnumProvider.ORDERSLIST order in orders) OrdersInMind.AddOrder(order, Vector3.zero, ++UOID); }
public virtual void MappingData(EnumProvider providerCheck, string authenID, string localGameID, GameMapID gameMaps, Action <EnumMappingState, SocialMapID, GameMapID> callback) { }
abstract protected EnumProvider.ORDERSLIST on_UnitStateChange(EnumProvider.ORDERSLIST stateorder);
public void AddOrder(EnumProvider.ORDERSLIST order,Vector3 point,int id) { orderList.Add(new OrderChunk(order,point,id)); }
public GolContext(DbContextOptions <GolContext> options, EnumProvider provider, string connectionString) : base(GetOptions(provider, connectionString, options)) { Provider = provider; ConnectionString = connectionString; EnsureCreated(); }
virtual internal void GiveOrder(EnumProvider.ORDERSLIST order) { UnitState = order; }