void OnMouseUpAsButton() { storageService = sp.BuildStorageService(); // Initializing Storage Service //storageService.UpdateDocumentByKeyValue (dbName, collectionName, key, value, jsonDoc, callBack); storageService.InsertJSONDocument(dbName, collectionName, json, callBack); Debug.Log("La partida ha sido guardada."); }
public void AsyncApp42Api() { ServiceAPI sp = new ServiceAPI("43f6b65747952492b5e30056ac9539ef7c50b44c4178e7c361cfa3b20ee52095", "e09348180158fb9304906d696dec68b3e2f074747a09ec93284271627f7c2599"); this.userService = sp.BuildUserService(); this.storageService = sp.BuildStorageService(); this.pushService = sp.BuildPushNotificationService(); this.socialService = sp.BuildSocialService(); }
void Awake() { // set the static variable so that other classes can easily use this class instance = this; // If game menu, disable right after initialisation if (isGameMenu) { this.enabled = false; return; } ToggleSound(Game.instance.audio); // Initialise timer components Time.timeScale = 1f; timeElapsed = 0; isUrgent = false; // Initialise variables failedAttempts = 0; consumablesUsed = 0; // Get the total number of ntp and gtp ntpMax = GameObject.FindGameObjectsWithTag("ntp").Length; gtpMax = GameObject.FindGameObjectsWithTag("gtp").Length; capsuleMax = GameObject.FindGameObjectsWithTag("capsule").Length; // Retrieve all backgrounds backgrounds = GameObject.FindGameObjectsWithTag("Background"); bgZoomInScale = backgrounds[0].transform.localScale; bgZoomOutScale = bgZoomInScale * bgScaling; curBgScale = bgZoomInScale; // Alter culling mask ot hide map indicator camera.cullingMask = ~(1 << LayerMask.NameToLayer("Minimap")); #region App42 #if UNITY_EDITOR ServicePointManager.ServerCertificateValidationCallback = Validator; #endif // Connect to the app service serviceAPI = new ServiceAPI(Constants.apiKey, Constants.secretKey); // Build the storage service storageService = serviceAPI.BuildStorageService(); #endregion }
public void comprobarlogin() { if (UserResponse.resul == "vacio") { Debug.Log("El Usuario se ha logueado."); Dictionary <string, object> jsonDoc = new Dictionary <string, object>(); storageService = sp.BuildStorageService(); storageService.FindDocumentById(dbName, collectionName, jsonid, callBack); Save(); } else { message.SetActive(false); faltan.text = "Incorrect username or password."; } }
void Start() { #if UNITY_EDITOR ServicePointManager.ServerCertificateValidationCallback = Validator; #endif // Connect to the app service serviceAPI = new ServiceAPI(Constants.apiKey, Constants.secretKey); // Build the log service logService = serviceAPI.BuildLogService(); // Build the storage service storageService = serviceAPI.BuildStorageService(); // Get the device number deviceId = SystemInfo.deviceUniqueIdentifier; // Log the event logService.SetEvent("[DEMO] Feedback", "Landed", logCallBack); #region GUI Styling containerRect = new Rect(Screen.width * ((1 - containerWidth) / 2), Screen.height * ((1 - containerHeight) / 2), Screen.width * containerWidth, Screen.height * containerHeight); // Set the header style headerStyle = new GUIStyle(activeSkin.customStyles[0]); headerStyle.fontSize = (int)(Screen.height * headerFontScaling); headerStyle.padding.left = (int)(containerRect.width * labelHorPadding); headerStyle.padding.right = (int)(containerRect.width * labelHorPadding); // Set the label style labelStyle = activeSkin.label; labelStyle.fontSize = (int)(Screen.height * labelFontScaling); labelStyle.padding.left = (int)(containerRect.width * labelHorPadding); labelStyle.padding.right = (int)(containerRect.width * labelHorPadding); // set the error msg style alertMsgStyle = new GUIStyle(activeSkin.customStyles[1]); alertMsgStyle.fontSize = labelStyle.fontSize; alertMsgStyle.padding.left = (int)(containerRect.width * labelHorPadding); alertMsgStyle.padding.right = (int)(containerRect.width * labelHorPadding); // Set the textArea style txtAreaStyle = activeSkin.textArea; txtAreaStyle.fontSize = (int)(Screen.height * txtAreaFontScaling); txtAreaStyle.padding.top = (int)(txtAreaStyle.fontSize * txtAreaTopPadding); txtAreaStyle.padding.bottom = (int)(txtAreaStyle.fontSize * txtAreaBtmPadding); // Set the radio button styles radioBtnStyle = new GUIStyle(activeSkin.customStyles[2]); radioBtnStyle.fontSize = (int)(Screen.height * radioButtonFontScaling); var dimension = (int)(radioBtnStyle.fontSize * radioButtonSize); radioBtnStyle.fixedHeight = dimension; radioBtnStyle.fixedWidth = dimension; radioBtnStyle.margin.right = (int)((float)dimension * 0.25f); radioBtnStyle.margin.left = (int)((float)dimension * 0.25f); // Set the button styles btnWidth = Screen.width * 0.3f; btnHeight = btnWidth * ((float)activeSkin.button.normal.background.height / (float)activeSkin.button.normal.background.width); // Font scaling activeSkin.button.fontSize = (int)(btnHeight * buttonFontScaling); // Padding Scaling activeSkin.button.padding.top = (int)(activeSkin.button.fontSize * buttonTopPadding); A_btnStyle = new GUIStyle(activeSkin.button); B_btnStyle = new GUIStyle(activeSkin.button); #region positioning // initialise variable to calculate total height float totalHeight = 0; float frameWidth = Screen.width * innerFrameWidth; // header label labelHeight = headerStyle.CalcHeight(new GUIContent(header), frameWidth); headerRect = new Rect(0, totalHeight, frameWidth, labelHeight); totalHeight += labelHeight; // feedback 1 label labelHeight = labelStyle.CalcHeight(new GUIContent(feedback_1), frameWidth); label_Feedback1Rect = new Rect(0, totalHeight, frameWidth, labelHeight); totalHeight += labelHeight; // feedback 1 text area txtAreaHeight = (txtAreaStyle.fontSize * fontHeightScale) * 3 + txtAreaStyle.padding.top + txtAreaStyle.padding.bottom; txtArea_Feedback1 = new Rect(0, totalHeight, frameWidth, txtAreaHeight); totalHeight += txtAreaHeight; // feedback 2 label labelHeight = labelStyle.CalcHeight(new GUIContent(feedback_2), frameWidth); label_Feedback2Rect = new Rect(0, totalHeight, frameWidth, labelHeight); totalHeight += labelHeight; // feedback 2 text area txtAreaHeight = (txtAreaStyle.fontSize * fontHeightScale) * 3 + txtAreaStyle.padding.top + txtAreaStyle.padding.bottom; txtArea_Feedback2 = new Rect(0, totalHeight, frameWidth, txtAreaHeight); totalHeight += txtAreaHeight; // feedback 3 label labelHeight = labelStyle.CalcHeight(new GUIContent(feedback_3), frameWidth); label_Feedback3Rect = new Rect(0, totalHeight, frameWidth, labelHeight); totalHeight += labelHeight; // feedback 3 text area txtAreaHeight = (txtAreaStyle.fontSize * fontHeightScale) * 3 + txtAreaStyle.padding.top + txtAreaStyle.padding.bottom; txtArea_Feedback3 = new Rect(0, totalHeight, frameWidth, txtAreaHeight); totalHeight += txtAreaHeight; // feedback 4 label labelHeight = labelStyle.CalcHeight(new GUIContent(feedback_4), frameWidth); label_Feedback4Rect = new Rect(0, totalHeight, frameWidth, labelHeight); totalHeight += labelHeight; // feedback 4 text area txtAreaHeight = (txtAreaStyle.fontSize * fontHeightScale) * 3 + txtAreaStyle.padding.top + txtAreaStyle.padding.bottom; txtArea_Feedback4 = new Rect(0, totalHeight, frameWidth, txtAreaHeight); totalHeight += txtAreaHeight; // feedback 5 label labelHeight = labelStyle.CalcHeight(new GUIContent(label_rate), frameWidth); label_RateRect = new Rect(0, totalHeight, frameWidth, labelHeight); totalHeight += labelHeight; // radio button radioBtnRect = new Rect(0, totalHeight, frameWidth, dimension); totalHeight += dimension; // main menu and submit buttons A_btnRect = new Rect(0, totalHeight, btnWidth, btnHeight); B_btnRect = new Rect(frameWidth - btnWidth, totalHeight, btnWidth, btnHeight); totalHeight += btnHeight; // Initialise button scalers A_btnScale = new ButtonHandler(A_btnRect, gameObject, 0.9f, "A_ScaleButton"); B_btnScale = new ButtonHandler(B_btnRect, gameObject, 0.9f, "B_ScaleButton"); #endregion innerFrameRect = new Rect(0, 0, frameWidth, totalHeight); innerFrameHeight = totalHeight; #endregion }
protected override void OnNavigatedTo(NavigationEventArgs e) { System.Diagnostics.Debug.WriteLine("On navigated to loading"); timeout = 0; MediaElementData[0] = t1; MediaElementData[1] = t2; Global.MyAudio[0] = App.GlobalMediaElement0; Global.MyAudio[1] = App.GlobalMediaElement1; Global.MyAudio[2] = App.GlobalMediaElement2; Global.MyAudio[3] = App.GlobalMediaElement3; Global.MyAudio[4] = App.GlobalMediaElement4; Global.opponentUsername = ""; Deployment.Current.Dispatcher.BeginInvoke(() => { ready.Text = Global.localUsername + " \nvs\n"; }); _dispatcherTimer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(1) }; _dispatcherTimer.Tick += UpdateMediaData; _dispatcherTimer.Start(); i = 0; k = 0; B(false); requestCallback = this; App42API.Initialize(Constants.API_KEY, Constants.SECRET_KEY); App42Log.SetDebug(true); ServiceAPI api = new ServiceAPI(Constants.API_KEY, Constants.SECRET_KEY); storage = api.BuildStorageService(); uploadService = api.BuildUploadService(); System.Diagnostics.Debug.WriteLine("Before warp"); WarpClient.initialize(Constants.API_KEY, Constants.SECRET_KEY); WarpClient.setRecoveryAllowance(60); Global.warpClient = WarpClient.GetInstance(); //trivia if ((int)settings["trigger"] == 0) TriviaTB.Text = Global.TriviaB[(new Random()).Next(Global.TriviaB.Length)]; else TriviaTB.Text = Global.TriviaH[(new Random()).Next(Global.TriviaH.Length)]; Global.disconnectSuccess = false; Global.deleteSuccess = false; Global.conListenObj = new ConnectionListener(this); Global.roomReqListenerObj = new RoomReqListener(this); Global.zoneReqListenerObj = new ZoneRequestListener(this); Global.notificationListenerObj = new NotificationListener(this); Global.warpClient.AddConnectionRequestListener(Global.conListenObj); Global.warpClient.AddRoomRequestListener(Global.roomReqListenerObj); Global.warpClient.AddNotificationListener(Global.notificationListenerObj); Global.warpClient.AddZoneRequestListener(Global.zoneReqListenerObj); Global.warpClient.Connect(Global.localUsername); System.Diagnostics.Debug.WriteLine("after warp"); }
void OnGUI() { if (Time.time % 2 < 1) { success = callBack.getResult(); } // For Setting Up ResponseBox. GUI.TextArea(new Rect(10, 5, 1000, 175), success); //===================================**************========================================= if (GUI.Button(new Rect(50, 200, 200, 30), "Insert JsonDoc")) { storageService = sp.BuildStorageService(); // Initializing Storage Service. storageService.InsertJSONDocument(cons.dbName, collectionName, cons.json, callBack); } //===================================**************========================================= if (GUI.Button(new Rect(260, 200, 200, 30), "Find AllDocuments")) { storageService = sp.BuildStorageService(); // Initializing Storage Service. storageService.FindAllDocuments(cons.dbName, collectionName, callBack); } //===================================**************========================================= if (GUI.Button(new Rect(470, 200, 200, 30), "Find AllCollections")) { storageService = sp.BuildStorageService(); // Initializing Storage Service. storageService.FindAllCollections(cons.dbName, callBack); } //===================================**************========================================= if (GUI.Button(new Rect(680, 200, 200, 30), "Find DocumentById")) { storageService = sp.BuildStorageService(); // Initializing Storage Service. storageService.FindDocumentById(cons.dbName, collectionName, cons.docId, callBack); } //===================================**************========================================= if (GUI.Button(new Rect(890, 200, 200, 30), "Find DocumentByKeyValue")) { storageService = sp.BuildStorageService(); // Initializing Storage Service. storageService.FindDocumentByKeyValue(cons.dbName, collectionName, cons.key, cons.val, callBack); } //===================================**************========================================= if (GUI.Button(new Rect(50, 250, 200, 30), "UpdateDocumentByKeyValue")) { storageService = sp.BuildStorageService(); // Initializing Storage Service. storageService.UpdateDocumentByKeyValue(cons.dbName, collectionName, cons.key, cons.val, cons.newJson, callBack); } //===================================**************========================================= if (GUI.Button(new Rect(260, 250, 200, 30), "UpdateDocumentById")) { storageService = sp.BuildStorageService(); // Initializing Storage Service. storageService.UpdateDocumentByDocId(cons.dbName, collectionName, cons.docId, cons.newJson, callBack); } //===================================**************========================================= if (GUI.Button(new Rect(470, 250, 200, 30), "Delete DocumentById")) { storageService = sp.BuildStorageService(); // Initializing Storage Service. storageService.DeleteDocumentById(cons.dbName, collectionName, cons.docId, callBack); } //===================================**************========================================= if (GUI.Button(new Rect(680, 250, 200, 30), "Delete DocumentsByKeyValue")) { storageService = sp.BuildStorageService(); // Initializing Storage Service. storageService.DeleteDocumentsByKeyValue(cons.dbName, collectionName, cons.key, cons.val, callBack); } //===================================**************========================================= if (GUI.Button(new Rect(890, 250, 200, 30), "DeleteAllDocuments")) { storageService = sp.BuildStorageService(); // Initializing Storage Service. storageService.DeleteAllDocuments(cons.dbName, collectionName, callBack); } //===================================**************========================================= if (GUI.Button(new Rect(260, 300, 200, 30), "FindAllDocumentsCount")) { storageService = sp.BuildStorageService(); // Initializing Storage Service. storageService.FindAllDocumentsCount(cons.dbName, collectionName, callBack); } //===================================**************========================================= if (GUI.Button(new Rect(470, 300, 200, 30), "FindAllDocumentsByPaging")) { storageService = sp.BuildStorageService(); // Initializing Storage Service. storageService.FindAllDocuments(cons.dbName, collectionName, max, offSet, callBack); } //===================================**************========================================= if (GUI.Button(new Rect(680, 300, 200, 30), "InsertJsonWithGeoTag")) { storageService = sp.BuildStorageService(); // Initializing Storage Service. GeoTag gp = new GeoTag(); gp.SetLat(-73.99171); gp.SetLng(40.738868); storageService.SetGeoTag(gp); storageService.InsertJSONDocument(cons.dbName, collectionName, cons.json, callBack); } //===================================**************========================================= if (GUI.Button(new Rect(890, 300, 200, 30), "FindDocumentsByLocation")) { storageService = sp.BuildStorageService(); // Initializing Storage Service. GeoTag gp = new GeoTag(); gp.SetLat(-73.99171); gp.SetLng(40.738868); GeoQuery query = QueryBuilder.BuildGeoQuery(gp, GeoOperator.NEAR, 100); storageService.FindDocumentsByLocation(cons.dbName, collectionName, query, callBack); } //===================================**************========================================= if (GUI.Button(new Rect(50, 350, 200, 30), "FindAllDocumentsSelectKeys")) { storageService = sp.BuildStorageService(); // Initializing Storage Service. HashSet <string> selectKeys = new HashSet <string> (); selectKeys.Add("Name"); storageService.SetSelectKeys(selectKeys); storageService.FindAllDocuments(cons.dbName, collectionName, callBack); } //===================================**************========================================= if (GUI.Button(new Rect(260, 350, 200, 30), "FindDocumentsByQuery")) { storageService = sp.BuildStorageService(); // Initializing Storage Service. Query q1 = QueryBuilder.Build("AppName", "de", Operator.LIKE); Query q2 = QueryBuilder.Build("AppId", "123hg4bdb", Operator.LIKE); Query q3 = QueryBuilder.CompoundOperator(q1, Operator.OR, q2); storageService.FindDocumentsByQuery(cons.dbName, collectionName, q3, callBack); } //===================================**************========================================= if (GUI.Button(new Rect(470, 350, 200, 30), "SaveOrUpdateDocument")) { storageService = sp.BuildStorageService(); // Initializing Storage Service. storageService.SaveOrUpdateDocumentByKeyValue(cons.dbName, collectionName, cons.key, cons.val, cons.newJson, callBack); } }
void OnMouseUpAsButton() { storageService = sp.BuildStorageService(); // Initializing Storage Service. storageService.FindDocumentById(dbName, collectionName, fgs, callBack); Debug.Log("Archivo encontrado."); }
void Awake() { #region App42 #if UNITY_EDITOR ServicePointManager.ServerCertificateValidationCallback = Validator; #endif // Connect to the app service serviceAPI = new ServiceAPI(Constants.apiKey, Constants.secretKey); // Build the log service logService = serviceAPI.BuildLogService(); // Build the storage service storageService = serviceAPI.BuildStorageService(); // Log the event logService.SetEvent("[DEMO] Title Screen", "Landed", logCallBack); logService.SetEvent("[DEMO] Title Screen", logCallBack); #endregion #region GUI logoContainerWidth = Screen.width * 0.6f; logoContainerHeight = Screen.height; logoContainerRect = new Rect(0, 0, logoContainerWidth, logoContainerHeight); logoTexture = activeSkin.customStyles[0].normal.background; logoWidth = logoContainerWidth; logoHeight = logoWidth * ((float)logoTexture.height / (float)logoTexture.width); logoXOffset = 0; logoYOffset = 0; logoRect = new Rect(logoXOffset, logoYOffset, logoWidth, logoHeight); // Font auto scaling activeSkin.label.fontSize = (int)(Screen.height * demoTextFontScale); demoTextRect = new Rect(0, logoHeight * 0.8f, logoContainerWidth, activeSkin.label.fontSize * 2); navContainerWidth = Screen.width * 0.3f; navContainerXOffset = logoContainerWidth; btnWidth = navContainerWidth; btnHeight = navContainerWidth * ((float)activeSkin.button.normal.background.height / (float)activeSkin.button.normal.background.width); navContainerHeight = btnHeight * 5; navContainerYOffset = (Screen.height - navContainerHeight) * 0.5f; navContainerRect = new Rect(navContainerXOffset, navContainerYOffset, navContainerWidth, navContainerHeight); A_btnRect = new Rect(0, 0, btnWidth, btnHeight); B_btnRect = new Rect(0, btnHeight, btnWidth, btnHeight); C_btnRect = new Rect(0, btnHeight * 2, btnWidth, btnHeight); D_btnRect = new Rect(0, btnHeight * 3, btnWidth, btnHeight); E_btnRect = new Rect(0, btnHeight * 4, btnWidth, btnHeight); // Initialise button scalers A_btnScale = new ButtonHandler(A_btnRect, gameObject, 0.9f, "A_ScaleButton"); B_btnScale = new ButtonHandler(B_btnRect, gameObject, 0.9f, "B_ScaleButton"); C_btnScale = new ButtonHandler(C_btnRect, gameObject, 0.9f, "C_ScaleButton"); D_btnScale = new ButtonHandler(D_btnRect, gameObject, 0.9f, "D_ScaleButton"); E_btnScale = new ButtonHandler(E_btnRect, gameObject, 0.9f, "E_ScaleButton"); // Nav button font scaling activeSkin.button.fontSize = (int)(btnHeight * navFontScaling); // Padding Scaling activeSkin.button.padding.top = (int)(activeSkin.button.fontSize * navTopPaddingScaling); activeSkin.button.padding.bottom = (int)(activeSkin.button.fontSize * navBottomPaddingScaling); // Set the styles A_btnStyle = new GUIStyle(activeSkin.button); B_btnStyle = new GUIStyle(activeSkin.button); C_btnStyle = new GUIStyle(activeSkin.button); D_btnStyle = new GUIStyle(activeSkin.button); E_btnStyle = new GUIStyle(activeSkin.button); #endregion }
protected override void OnNavigatedTo(NavigationEventArgs e) { System.Diagnostics.Debug.WriteLine("On navigated to loading"); timeout = 0; MediaElementData[0] = t1; MediaElementData[1] = t2; Global.MyAudio[0] = App.GlobalMediaElement0; Global.MyAudio[1] = App.GlobalMediaElement1; Global.MyAudio[2] = App.GlobalMediaElement2; Global.MyAudio[3] = App.GlobalMediaElement3; Global.MyAudio[4] = App.GlobalMediaElement4; Global.opponentUsername = ""; Deployment.Current.Dispatcher.BeginInvoke(() => { ready.Text = Global.localUsername + " \nvs\n"; }); _dispatcherTimer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(1) }; _dispatcherTimer.Tick += UpdateMediaData; _dispatcherTimer.Start(); i = 0; k = 0; B(false); requestCallback = this; App42API.Initialize(Constants.API_KEY, Constants.SECRET_KEY); App42Log.SetDebug(true); ServiceAPI api = new ServiceAPI(Constants.API_KEY, Constants.SECRET_KEY); storage = api.BuildStorageService(); uploadService = api.BuildUploadService(); System.Diagnostics.Debug.WriteLine("Before warp"); WarpClient.initialize(Constants.API_KEY, Constants.SECRET_KEY); WarpClient.setRecoveryAllowance(60); Global.warpClient = WarpClient.GetInstance(); //trivia if ((int)settings["trigger"] == 0) { TriviaTB.Text = Global.TriviaB[(new Random()).Next(Global.TriviaB.Length)]; } else { TriviaTB.Text = Global.TriviaH[(new Random()).Next(Global.TriviaH.Length)]; } Global.disconnectSuccess = false; Global.deleteSuccess = false; Global.conListenObj = new ConnectionListener(this); Global.roomReqListenerObj = new RoomReqListener(this); Global.zoneReqListenerObj = new ZoneRequestListener(this); Global.notificationListenerObj = new NotificationListener(this); Global.warpClient.AddConnectionRequestListener(Global.conListenObj); Global.warpClient.AddRoomRequestListener(Global.roomReqListenerObj); Global.warpClient.AddNotificationListener(Global.notificationListenerObj); Global.warpClient.AddZoneRequestListener(Global.zoneReqListenerObj); Global.warpClient.Connect(Global.localUsername); System.Diagnostics.Debug.WriteLine("after warp"); }
public static StorageService GetStorageService(ServiceAPI sp) { return sp.BuildStorageService(); }