/// <summary> /// Creates a new team memeber /// </summary> public void CreateMember() { User result = null; if (UserObject.password == string.Empty) { result = new User(); Enjin.InviteUser(UserObject.email, UserObject.name); } else { result = Enjin.CreateUser(UserObject.name, UserObject.email, UserObject.password, RolesList[RoleDropDownSelection].name); } if (result != null && Enjin.ServerResponse == ResponseCodes.SUCCESS) { if (UserObject.password == string.Empty) { EnjinEditor.DisplayDialog("SUCCESS", "User " + UserObject.name + " successfully created and invite sent."); } else { EnjinEditor.DisplayDialog("SUCCESS", "User " + UserObject.name + " successfully created."); } EnjinEditor.ExecuteMethod(EnjinEditor.CallMethod.RELOADTEAM); EnjinEditor.ExecuteMethod(EnjinEditor.CallMethod.RELOADIDENTITIES); SetTeamState(TeamState.VIEWLIST); } else { EnjinEditor.DisplayDialog("FAILED", "Eamil address: " + UserObject.email + " has already been registered. Please enter a different email address"); } }
/// <summary> /// Refreshes the current users roles & permissions /// </summary> private static void RefreshUserRoles() { CurrentUser = Enjin.GetUser(CurrentUser.id); _userPermissions = new List <string>(); _userRoles = new Dictionary <string, List <string> >(); for (int i = 0; i < CurrentUser.roles.Length; i++) { string roleName = CurrentUser.roles[i].name.ToUpper(); roleName = roleName.Replace(" ", "_"); // converts PLATFORM OWNER to List <string> permissions = new List <string>(); for (int n = 0; n < CurrentUser.roles[i].permissions.Length; n++) { if (!permissions.Contains(CurrentUser.roles[i].permissions[n].name)) { permissions.Add(CurrentUser.roles[i].permissions[n].name); } if (!_userPermissions.Contains(CurrentUser.roles[i].permissions[n].name)) { _userPermissions.Add(CurrentUser.roles[i].permissions[n].name); } } if (_userRoles.ContainsKey(roleName)) { _userRoles.Remove(roleName); } _userRoles.Add(roleName, permissions); } }
/// <summary> /// Creates a list of all apps team member has access to /// </summary> /// <param name="identities">Current team members identity</param> private static void RefreshAppList() { AppList = new List <AppSelectorData>(Enjin.GetAppsByUserID(CurrentUser.id)); if (AppList.Count == 0) { Enjin.AppID = -1; return; } AppsNameList = new List <string>(); foreach (AppSelectorData app in AppList) { AppsNameList.Add(app.appName); } Enjin.AppID = AppList[SelectedAppIndex].appID; CurrentUserIdentity = Enjin.GetIdentity(AppList[SelectedAppIndex].identityID); CurrentUser = Enjin.GetUser(CurrentUser.id); if (CurrentUserIdentity == null || CurrentUserIdentity.id == 0) { for (int i = 0; i < CurrentUser.identities.Length; i++) { if (CurrentUser.identities[i].app_id == Enjin.AppID) { CurrentUserIdentity = CurrentUser.identities[i]; } } } }
/// <summary> /// Gets a page list of users /// </summary> /// <param name="page">Current page to get</param> public void GetPage(int page) { Pagination = Enjin.GetUsersByAppID(page, EnjinEditor.ItemsPerPage); TotalPages = (int)Mathf.Ceil((float)Pagination.cursor.total / (float)Pagination.cursor.perPage); UserList = new List <User>(Pagination.items); HasRefreshedList = true; }
static IEnumerator WaitForRequest(UnityWebRequest data, System.Action <string> handler) { yield return(data.SendWebRequest()); if (data.error != null) { Enjin.IsRequestValid(data.responseCode, data.downloadHandler.text); queryStatus = Status.Error; } else { if (Enjin.IsRequestValid(data.responseCode, data.downloadHandler.text)) { queryReturn = data.downloadHandler.text; queryStatus = Status.Complete; if (Enjin.IsDebugLogActive) { Debug.Log("<color=orange>[GRAPHQL RESULTS]</color> " + queryReturn); } handler(queryReturn); } else { queryReturn = "ERROR"; } } //OnQueryComplete(); }
// A helper method to prepare the game for play. private void SetupPlay() { SetStatus("Linked successfully.\nYour score is: " + score, false); tutorial.text = Resources.Load <TextAsset>("play-game-tutorial").text; count = Enjin.GetCryptoItemBalance(identityId, REWARD_TOKEN_ID); inventory.text = (tokenName + "\nYou have: " + count + "\nCurrently pending: " + pending); ShowPanel(gamePanel); }
// This method tests Enjin's non-runtime API methods mostly used in the editor window. private void TestStaticEndpoints() { // Helper methods. TestMethod(() => { Enjin.StoreUserData(new User(), "test"); }, "user data storage"); TestMethod <Boolean>(() => { return(Enjin.ValidateAddress("0xf629cbd94d3791c9250152bd8dfbdf380e2a3b9c")); }, true, "address validation"); TestMethod(() => { Enjin.URLGetData("https://enjincoin.io/", new System.Collections.Generic.Dictionary <string, string>()); }, "fetching URL data"); TestMethod <String>(() => { return(Enjin.URLGetData("bad URL", new System.Collections.Generic.Dictionary <string, string>())); }, string.Empty, "expected result from bad URL data"); TestMethod(() => { Enjin.ResetErrorReport(); }, "error report reset"); // CryptoItems methods. TestMethod(() => { Enjin.GetCryptoItemBalance(testingIdentityID, TESTING_ITEM_ID); }, "balance by identity"); TestMethod(() => { Enjin.GetMintableItems(TESTING_ITEM_ID); }, "mintable item retrieval"); TestMethod(() => { CryptoItem item = Enjin.GetCryptoItem(TESTING_ITEM_ID); Enjin.GetCryptoItemIDByName(item.name); }, "item identity by name"); TestMethod(() => { Enjin.GetCryptoItemBalances(testingIdentityID); }, "all balances by identity"); TestMethod(() => { Enjin.UpdateCryptoItem(new CryptoItem()); }, "item updating"); TestMethod(() => { Enjin.GetAllCryptoItems(); }, "searching all items"); TestMethod(() => { CryptoItem item = Enjin.GetCryptoItem(TESTING_ITEM_ID); Enjin.GetCryptoItemIDByName(item.name); }, "searching for item name"); TestMethod(() => { Enjin.GetAllItems(0, 0, DEVELOPER_IDENTITY_ID); }, "getting all items by page"); TestMethod(() => { Enjin.GetAllItems(DEVELOPER_IDENTITY_ID); }, "getting all items"); // Enjin Platform API methods. TestMethod(() => { Enjin.GetTotalActiveTokens(DEVELOPER_IDENTITY_ID); }, "getting all active tokens"); TestMethod(() => { Enjin.GetAppsByUserID(loginUser.id); }, "getting apps for user"); TestMethod(() => { Enjin.GetAppByID(APP_ID); }, "getting app by id"); // Identity methods. TestMethod(() => { Enjin.UpdateBalances(new Identity()); }, "identity balance updates"); TestMethod(() => { Enjin.GetIdentity(testingIdentityID); }, "identity retrieval"); TestMethod(() => { Enjin.GetAllIdentities(); }, "bulk identity retrieval"); TestMethod(() => { Enjin.SearchIdentities("enjin"); }, "identity search"); Identity sampleIdentity = new Identity { user = new Identity.User { name = loginUser.name, id = loginUser.id }, id = testingIdentityID, fields = new Fields[] { new Fields("test", "enjin", 0, 0, 0) } }; TestMethod(() => { Enjin.UpdateIdentity(sampleIdentity); }, "identity update"); Enjin.AccessToken = TESTER_TOKEN; TestMethod(() => { Enjin.UpdateIdentityFields(testingIdentityID, new Fields[] { new Fields("test", "enjin!", 0, 0, 0) }); }, "identity field update"); TestMethod(() => { Enjin.LinkIdentity(sampleIdentity); }, "identity link"); TestMethod(() => { Enjin.UnLinkIdentity(testingIdentityID); }, "identity unlinking"); TestMethod(() => { Enjin.DeleteIdentity(testingIdentityID + ""); }, "identity deletion"); TestMethod(() => { Enjin.CreateIdentity(sampleIdentity); }, "identity creation"); TestMethod(() => { Enjin.GetRoles(); }, "fetching identity roles"); TestMethod(() => { Enjin.GetIdentities(0, 0); }, "fetching identity pages"); }
/// <summary> /// Deletes the role /// </summary> public void DeleteRole() { if (Enjin.DeleteRole(RolesList[SelectedRoleIndex]) != null) { RolesList = GetRolesList(); LastSelectedRoleIndex = -1; SelectedRoleIndex = 0; } }
public void DisplayErrorDialog() { if (Enjin.ErrorReport == null || Enjin.ErrorReport.ErrorCode == 0) { return; } DisplayDialog("ERROR " + Enjin.ErrorReport.ErrorCode.ToString(), Enjin.ErrorReport.ErrorMessage); Enjin.ResetErrorReport(); }
private void UnlinkedWallet() { GUILayout.BeginArea(new Rect(5, 10, 912, 606), _skin.GetStyle("TopBackground")); EditorGUILayout.LabelField(new GUIContent("LINK WALLET"), _skin.GetStyle("MainTitle")); GUILayout.Space(30); EditorGUILayout.BeginHorizontal(); GUILayout.Space(14); EditorGUILayout.LabelField(new GUIContent("Step 1:"), _skin.GetStyle("BoldTitle"), GUILayout.Width(50)); EditorGUILayout.LabelField(new GUIContent("Download the Enjin Wallet"), _skin.GetStyle("ContentLight")); EditorGUILayout.EndHorizontal(); GUILayout.Space(10); EditorGUILayout.BeginHorizontal(); GUILayout.Space(14); //if (GUILayout.Button(new GUIContent("Enjin Wallet iOS"), GUILayout.Width(140), GUILayout.Height(30))) // Application.OpenURL("https://itunes.apple.com/us/app/enjin-cryptocurrency-wallet/id1349078375?ls=1&mt=8"); if (GUILayout.Button(new GUIContent("Enjin Wallet"), GUILayout.Width(140), GUILayout.Height(30))) { Application.OpenURL("https://enjinwallet.io/"); } //Application.OpenURL("https://play.google.com/store/apps/details?id=com.enjin.mobile.wallet"); EditorGUILayout.EndHorizontal(); GUILayout.Space(20); EditorGUILayout.BeginHorizontal(); GUILayout.Space(14); EditorGUILayout.LabelField(new GUIContent("Step 2:"), _skin.GetStyle("BoldTitle"), GUILayout.Width(50)); EditorGUILayout.LabelField(new GUIContent("Open the Enjin Wallet, select LINK in settings and enter this\nunique code:"), _skin.GetStyle("ContentLight"), GUILayout.Height(30)); EditorGUILayout.EndHorizontal(); GUILayout.Space(10); EditorGUILayout.BeginHorizontal(); GUILayout.Space(66); EditorGUILayout.LabelField(new GUIContent(EnjinEditor.CurrentUserIdentity.linking_code), _skin.GetStyle("LargeNumbersGreen")); EditorGUILayout.EndHorizontal(); GUILayout.Space(20); EditorGUILayout.BeginHorizontal(); GUILayout.Space(14); EditorGUILayout.LabelField(new GUIContent("Step 3:"), _skin.GetStyle("BoldTitle"), GUILayout.Width(50)); EditorGUILayout.LabelField(new GUIContent("After you entered the code, click refresh button below to\nconfirm that your wallet and address is linked."), _skin.GetStyle("ContentLight"), GUILayout.Height(30)); EditorGUILayout.EndHorizontal(); GUILayout.Space(10); EditorGUILayout.BeginHorizontal(); GUILayout.Space(14); if (GUILayout.Button(new GUIContent("Refresh"), GUILayout.Width(140), GUILayout.Height(30))) { EnjinEditor.CurrentUser = Enjin.GetUserRaw(EnjinEditor.CurrentUser.id); EnjinEditor.ExecuteMethod(EnjinEditor.CallMethod.RELOADALL); } EditorGUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); GUILayout.EndArea(); }
public void SetUserIDList() { UserIDs = new List <string>(); Identity[] userIDList = Enjin.GetAllIdentities(); foreach (Identity userID in userIDList) { UserIDs.Add(userID.user.id.ToString()); } }
/// <summary> /// Checks if login was successful /// </summary> /// <returns>true/false based on success</returns> public bool IsLoginSuccessful() { EnjinEditor.CurrentUser = Enjin.StartPlatform(LoginInfo.apiurl, LoginInfo.username, LoginInfo.password); if (EnjinEditor.CurrentUser == null) { _loginState = Enjin.LoginState; return(false); } return(true); }
/// <summary> /// Placeholder for request handling and passing results to a watch action/event to prompt for pop-up notifications /// </summary> /// <param name="task"></param> /// <param name="identity"></param> /// <param name="properties"></param> /// <returns></returns> internal Identity ProcessRequest(ProcessTasks task, Identity identity, Dictionary <string, object> properties) { Identity retv = null; switch (task) { case ProcessTasks.VIEW: break; case ProcessTasks.CREATE: retv = Enjin.CreateIdentity(identity); if (retv != null) { EditorUtility.DisplayDialog("SUCCESS", "Identity " + retv.id + " has been created for app id " + retv.app_id + ".", "Ok"); } else { EditorUtility.DisplayDialog("FAILURE", "Identity " + retv.id + " could not be created. Please see the Unity Console for the error returned.", "Ok"); } RefreshLists(); State = IdentityState.VIEW; break; case ProcessTasks.DELETE: break; case ProcessTasks.EDIT: if (CurrentIdentity.linking_code != "") { retv = Enjin.UpdateIdentity(CurrentIdentity); } else { retv = Enjin.UpdateIdentityFields(CurrentIdentity.id, CurrentIdentity.fields); } if (retv != null) { EditorUtility.DisplayDialog("SUCCESS", "Identity " + retv.id + " was updated successfully.", "Ok"); } else { EditorUtility.DisplayDialog("FAILURE", "Identity " + retv.id + " could not be updated. Please see the Unity Console for the error returned.", "Ok"); } RefreshLists(); State = IdentityState.VIEW; break; } return(retv); }
/// <summary> /// Checks if the user has selected a different application /// </summary> private static void CheckAppChanged() { if (SelectedAppIndex != LastSelectedApp) { LastSelectedApp = SelectedAppIndex; Enjin.AppID = AppList[SelectedAppIndex].appID; CurrentUserIdentity = Enjin.GetIdentity(AppList[SelectedAppIndex].identityID); ExecuteMethod(CallMethod.RELOADALL); _settingsTab.CheckAllowance(); Enjin.ResetPusher(); } }
/// <summary> /// Method to reset and refresh the list of Identities /// </summary> public void RefreshLists() { ResetLists(); CurrentPage = FirstPage; Pagination = Enjin.GetIdentities(CurrentPage, EnjinEditor.ItemsPerPage); TotalPages = (int)Mathf.Ceil((float)Pagination.cursor.total / (float)Pagination.cursor.perPage); IdentitiesList = new List <Identity>(Pagination.items); for (int i = 0; i < IdentitiesList.Count; i++) { FieldsFoldout.Add(false); } }
/// <summary> /// Updates an exsiting App /// </summary> public void UpdateAp() { App newApp = new App { name = AppInfo.name, image = AppInfo.image, description = AppInfo.description }; Enjin.UpdateApp(newApp); EnjinEditor.ExecuteMethod(EnjinEditor.CallMethod.REFRESHAPPLIST); State = PlatformState.VIEW; }
// Register the user as a new player on this app. public void Register() { string email = registrationEmail.text; Enjin.InviteUser(email); if (Enjin.ServerResponse != ResponseCodes.SUCCESS) { SetStatus("Failed to send registration email; check your logs.", true); } else { ShowPanel(proceedToLoginPanel); } }
/// <summary> /// Sets the state of the platform /// </summary> /// <param name="state">State to set platform to</param> public void SetPlatformState(PlatformState state) { State = state; if (state == PlatformState.EDIT) { App newApp = new App(); newApp = Enjin.GetAppByID(Enjin.AppID); AppInfo = new AppData { name = newApp.name, image = newApp.image, description = newApp.description }; } }
/// <summary> /// Pagination page check for searchable index /// </summary> public void PageCheck() { if (CurrentPage < FirstPage) { FirstPage = CurrentPage; } if (CurrentPage == (FirstPage + 10)) { FirstPage++; } Pagination = Enjin.GetAllItems(CurrentPage, EnjinEditor.ItemsPerPage, EnjinEditor.CurrentUserIdentity.id); CryptoItemList = new List <CryptoItem>(Pagination.items); SelectedIndex = 0; }
public void PageCheck() { if (CurrentPage < FirstPage) { FirstPage = CurrentPage; } if (CurrentPage == (FirstPage + 10)) { FirstPage++; } Pagination = Enjin.GetIdentities(CurrentPage, EnjinEditor.ItemsPerPage); IdentitiesList = new List <Identity>(Pagination.items); SelectedIndex = 0; }
/// <summary> /// Build and draw search pane (main CI tab) /// </summary> public void DrawPane(CryptoItemsController controller, GUISkin skin) { GUILayout.BeginArea(new Rect(248, 10, 670, 100), skin.GetStyle("TopBackground")); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(new GUIContent("SEARCH CRYPTOITEMS"), skin.GetStyle("MainTitle"), GUILayout.Width(190)); EditorGUILayout.BeginVertical(); GUILayout.Space(12); EditorGUILayout.LabelField(new GUIContent("Eth Address, CryptoItem ID, CryptoItem Name"), skin.GetStyle("ContentDark")); EditorGUILayout.EndVertical(); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginVertical(); GUILayout.FlexibleSpace(); EditorGUILayout.BeginHorizontal(); GUILayout.Space(16); controller.SearchText = EditorGUILayout.TextField(controller.SearchText, skin.textField, GUILayout.Height(30)); // NOTE: Below code will be reinstated once we have a filter system in place on TP to filter by search criteria //EditorStyles.popup.fixedHeight = 30; //EditorStyles.popup.fontSize = 12; //_searchOptionIndex = EditorGUILayout.Popup(_searchOptionIndex, _searchOptions, GUILayout.Width(140), GUILayout.Height(30)); //EditorStyles.popup.fixedHeight = 15; //EditorStyles.popup.fontSize = 11; if (GUILayout.Button(new GUIContent("SEARCH"), GUILayout.Width(100), GUILayout.Height(32))) { controller.CryptoItemList.Clear(); controller.CryptoItemList = new List <CryptoItem>(Enjin.SearchCryptoItems(controller.SearchText)); controller.HasListRefreshed = false; controller.IsSearchMode = true; controller.SelectedIndex = 0; } if (controller.SearchText == "" && !controller.HasListRefreshed) { controller.ResetCryptoItemList(); controller.HasListRefreshed = true; controller.IsSearchMode = false; controller.SelectedIndex = 0; } GUILayout.Space(10); EditorGUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); EditorGUILayout.EndVertical(); GUILayout.Space(10); GUILayout.EndArea(); }
/// <summary> /// Updates an existing team member /// </summary> public void UpdateMember() { List <string> userRoles = new List <string>(UserRoles); string roles = "["; for (int i = 0; i < UpdateUserObject.roles.Length; i++) { if (userRoles.Contains(UpdateUserObject.roles[i].name)) { roles += "\"" + UpdateUserObject.roles[i].name + "\""; if (i != UpdateUserObject.roles.Length) { roles += ","; } } } if (RoleDropDownSelection != -1) { roles += "\"" + UserRoles[RoleDropDownSelection] + "\"]"; } else { roles += "]"; } if (UserObject.email == UpdateUserObject.email) { UpdateUserObject.email = string.Empty; } Enjin.UpdateUser(UserObject.id, UserObject.name, UpdateUserObject.email, roles); if (Enjin.ServerResponse == ResponseCodes.SUCCESS) { if (UnityEditor.EditorUtility.DisplayDialog("SUCCESS", "User updated successfully.", "OK")) { ResetTeamList(); } } SelectedRoleIndex = 0; EnjinEditor.ExecuteMethod(EnjinEditor.CallMethod.RELOADTEAM); EnjinEditor.ExecuteMethod(EnjinEditor.CallMethod.RELOADIDENTITIES); SetTeamState(TeamState.VIEWLIST); }
public void DrawSearchPane(IdentitiesTabController controller, GUISkin skin) { GUILayout.BeginArea(new Rect(5, 10, 912, 100), skin.GetStyle("TopBackground")); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(new GUIContent("SEARCH IDENTITIES"), skin.GetStyle("MainTitle"), GUILayout.Width(165)); EditorGUILayout.BeginVertical(); GUILayout.Space(12); EditorGUILayout.LabelField(new GUIContent("ID, User ID, Link Code, Eth Address"), skin.GetStyle("ContentDark")); EditorGUILayout.EndVertical(); EditorGUILayout.EndHorizontal(); GUILayout.Space(20); EditorGUILayout.BeginHorizontal(); GUILayout.Space(16); controller.SearchText = EditorGUILayout.TextField(controller.SearchText, skin.textField, GUILayout.Height(30)); if (GUILayout.Button(new GUIContent("Search"), GUILayout.Height(32), GUILayout.Width(100))) { controller.IdentitiesList.Clear(); controller.FieldsFoldout.Clear(); Identity[] sResults = Enjin.SearchIdentities(controller.SearchText); if (sResults != null) { controller.IdentitiesList = new List <Identity>(sResults); } for (int i = 0; i < controller.IdentitiesList.Count; i++) { controller.FieldsFoldout.Add(false); } controller.IsInSearchMode = true; controller.HasRefreshedList = false; } if (controller.SearchText == "" && !controller.HasRefreshedList) { controller.RefreshLists(); controller.IsInSearchMode = false; controller.HasRefreshedList = true; controller.SelectedIndex = 0; } EditorGUILayout.EndHorizontal(); GUILayout.EndArea(); }
/// <summary> /// Gets a list of roles for the app /// </summary> /// <returns>List of roles for appr</returns> private List <Roles> GetRolesList() { List <Roles> roles = new List <Roles>(Enjin.GetRoles()); if (roles != null) { for (int i = 0; i < roles.Count; i++) { if (roles[i].name.ToLower() == "platform owner") { roles.RemoveAt(i); break; } } } return(roles); }
/// <summary> /// Deletes the user (soft delete) /// </summary> /// <returns>true if deleting the user was successful, otherwise false</returns> public bool DeleteUser() { if (UserList.Count == 1 && CurrentPage != 1) { CurrentPage--; } if (Enjin.DeleteUser(UserList[SelectedIndex].id)) { SelectedIndex = 0; CurrentPage = 1; ResetTeamList(); EnjinEditor.ExecuteMethod(EnjinEditor.CallMethod.RELOADIDENTITIES); return(true); } return(false); }
/// <summary> /// Updates the news panel information /// </summary> private void GetLatestNews() { Dictionary <string, string> headerData = new Dictionary <string, string> { { "User-Agent", "UnitySDK" }, { "Content-type", "application/json" } }; string urlData = Enjin.URLGetData(_newsURL, headerData); if (urlData != string.Empty) { NewsData = JsonUtility.FromJson <NewsResult>(EnjinHelpers.GetJSONString(urlData, 1)).news; } else { NewsData = null; } }
/// <summary> /// Removes a give role from the current user /// </summary> public void RemoveRole(string role) { string roles = "["; for (int i = 0; i < UpdateUserObject.roles.Length; i++) { if (UpdateUserObject.roles[i].name == role) { continue; } roles += "\"" + UpdateUserObject.roles[i].name + "\""; if (i != UpdateUserObject.roles.Length) { roles += ","; } } roles += "]"; if (UserObject.email == UpdateUserObject.email) { UpdateUserObject.email = string.Empty; } EnjinEditor.Log("Roles - " + roles); Enjin.UpdateUser(UserObject.id, UserObject.name, UpdateUserObject.email, roles); if (Enjin.ServerResponse == ResponseCodes.SUCCESS) { if (UnityEditor.EditorUtility.DisplayDialog("SUCCESS", "Removed role successfully.", "OK")) { ResetTeamList(); } } SelectedRoleIndex = 0; EnjinEditor.ExecuteMethod(EnjinEditor.CallMethod.RELOADTEAM); SetTeamState(TeamState.VIEWLIST); }
/// <summary> /// Reset and revalidate the CI List /// </summary> public void ResetCryptoItemList() { if (CryptoItemList != null) { CryptoItemList.Clear(); CurrentPage = FirstPage; Pagination = Enjin.GetAllItems(CurrentPage, EnjinEditor.ItemsPerPage, EnjinEditor.CurrentUserIdentity.id); if (Pagination != null) { TotalPages = (int)Mathf.Ceil((float)Pagination.cursor.total / (float)Pagination.cursor.perPage); CryptoItemList = new List <CryptoItem>(Pagination.items); } else { TotalPages = 1; } } State = CryptoItemState.MAIN; }
/// <summary> /// Creates a new App /// </summary> public void CreateApp() { App newApp = new App { name = AppInfo.name, image = AppInfo.image, description = AppInfo.description }; if (newApp.image == "" || newApp.image == null) { newApp.image = "None"; } else { newApp.image = AppInfo.image; } if (newApp.description == "" || newApp.description == null) { newApp.description = "None"; } else { newApp.description = AppInfo.description; } Enjin.CreateApp(newApp); //EnjinEditor.ExecuteMethod(EnjinEditor.CallMethod.REFRESHAPPLIST); EnjinEditor.ExecuteMethod(EnjinEditor.CallMethod.LOGOUT); IsLoginSuccessful(); ProcessStartUp(); //Enjin.StartPlatform(Enjin.APIURL, LoginInfo.username, LoginInfo.password); //Enjin.Login(LoginInfo.username, LoginInfo.password); AppInfo = new AppData(); State = PlatformState.VIEW; }
public CryptoItemsController() { _resultQueue = new Dictionary <string, Result>(); ModelType = SupplyModel2.FIXED; ItemType = CryptoItemType.FUNGIBLE; CurrentPage = 1; FirstPage = 1; PageNumber = "01"; Pagination = Enjin.GetAllItems(CurrentPage, EnjinEditor.ItemsPerPage, EnjinEditor.CurrentUserIdentity.id); SelectedIndex = 0; SearchOptionIndex = 0; InitialItems = 1; FilterSelection = 1; LastFilterSelected = 1; ListItems = new string[9]; SelectedIndex = 0; EnjValue = 0; ScrollPos = Vector2.zero; LastFilterSelected = 1; CurrentCryptoItem = new CryptoItem(); HasListRefreshed = true; IsSearchMode = false; Whitelist = new List <string>(); NumToMelt = 0; EnjReturned = 0; EnjPerItem = 0; MinWei = System.Convert.ToInt64(GraphQLClient.GraphQuery.GetEndPointData(Enjin.MeltValueURL + 1)); if (Pagination != null) { TotalPages = (int)Mathf.Ceil((float)Pagination.cursor.total / (float)Pagination.cursor.perPage); CryptoItemList = new List <CryptoItem>(Pagination.items); } Reset(); Properties = new Dictionary <string, object>(); }