// Use this for initialization void Start() { profileUI = FindObjectOfType <ProfileUI>(); Assert.IsNotNull(profileUI, "Could not find Profile UI."); valueChecker = FindObjectOfType <ProfileValueChecker>(); Assert.IsNotNull(valueChecker, "Could not find Profile Setter."); }
/// <summary> /// Gets a random profile from the api. /// </summary> /// <param name="pUI">The ProfileUI to fill with the random info</param> /// <param name="index">The index to save the info at</param> /// <param name="scroller">A reference to the scroll script, used for saving the info</param> /// <returns></returns> public IEnumerator GetRandomProfileAPI(ProfileUI pUI, int index, ContactPersoonScroll scroller) { //Init default struct ProfileInfo pInfo = ProfileInfo.GetDefault(); //Get a random person json from the api UnityWebRequest request = UnityWebRequest.Get("https://randomuser.me/api/?inc=name,picture&nat=nl&noinfo"); yield return(request.SendWebRequest()); if (request.result == UnityWebRequest.Result.ConnectionError || request.result == UnityWebRequest.Result.ProtocolError) { Debug.Log(request.error); } RandomUserJson randomUserJson = null; //Try to parse the json, can contain errors from the api if its overloaded try { randomUserJson = JsonUtility.FromJson <RandomUserJson>(request.downloadHandler.text); } catch { //If returned bad data from api retry StartCoroutine(GetRandomProfileAPI(pUI, index, scroller)); yield break; } //Set name from api pInfo.name = randomUserJson.results[0].name.first + " " + randomUserJson.results[0].name.last; //Get the image from the given url request = UnityWebRequestTexture.GetTexture(randomUserJson.results[0].picture.medium); yield return(request.SendWebRequest()); if (request.result == UnityWebRequest.Result.ConnectionError || request.result == UnityWebRequest.Result.ProtocolError) { Debug.Log(request.error); } else { Texture2D tex = ((DownloadHandlerTexture)request.downloadHandler).texture; pInfo.picture = Sprite.Create(tex, new Rect(0.0f, 0.0f, tex.width, tex.height), new Vector2(0.5f, 0.5f)); } //Get a random job title pInfo.function = GetRandomJobFunction(); //actually update the UI and save it to the dict pUI.SetInfo(pInfo); scroller.AddToDict(index, pInfo); yield break; }
private void IngredientClicked(GameObject obj, Ingredient data) { if (profile == null) { profile = GameObject.FindGameObjectWithTag("ProfileUI").GetComponent <ProfileUI>(); } profile.CollectIngredient(data); StartCoroutine(AnimateOut(obj)); }
public void SaveProfile() { ProfileValueChecker valueChecker = FindObjectOfType <ProfileValueChecker>();; Debug.Log("Profile Saver is attempting to save the current Profile"); ProfileSetter profileSetter = FindObjectOfType <ProfileSetter>(); bool profileSetCorrectly = valueChecker.CheckFullProfile(); if (profileSetCorrectly) { Debug.Log("Profile appears correct, attempting to save."); GameManager instance = FindObjectOfType <GameManager>();; ProfileUI profileUI = FindObjectOfType <ProfileUI>();; bool nameCheck = true; for (int i = 0; i < instance.Profiles.Count; i++) { if (profileSetter.CurrentProfile.Name == instance.Profiles[i].Name) { Debug.Log("A profile with the name " + instance.Profiles[i].Name + " has been found."); nameCheck = false; profileToLoad = i; } } if (nameCheck) { ProfileMessager messager = FindObjectOfType <ProfileMessager>(); Debug.Log("The profile is okay to save."); //profileSetter.ClearExcessDamageChartEntries(); Debug.Log("Attempting to add the profile to the profile list."); ProfileCopier copier = FindObjectOfType <ProfileCopier>(); Profile saveProfile = copier.CopyProfile(profileSetter.CurrentProfile); instance.Profiles.Add(saveProfile); instance.SaveProfiles(); profileUI.EnableLoad(); StartCoroutine(messager.DisplayTemporaryMessage("Profile Saved.", false)); //} else if (overwrite) { // instance.Profiles[profileToLoad] = profile; // overwritePanel.SetActive(false); // instance.Save(); } else { profileUI.OpenNameCheckPanel(); } } }
void LoadProfile() { //Debug.Log("Clicked!"); if (Profile != null) { ProfileCopier copier = FindObjectOfType <ProfileCopier>(); ProfileLoader loader = FindObjectOfType <ProfileLoader>(); ProfileSetter setter = FindObjectOfType <ProfileSetter>(); ProfileUI ui = FindObjectOfType <ProfileUI>(); setter.CurrentProfile = copier.CopyProfile(Profile); loader.LoadProfile(setter.CurrentProfile); ui.Close(ProfileUI.CloseType.loadPanelLoad); } }
void LoadMainUI() { ShopUI.SetActive(false); ProfileUI.SetActive(false); RewardsUI.SetActive(false); RateUI.SetActive(false); SettingsUI.SetActive(false); MainUI.SetActive(true); RegisterCanvas.enabled = false; MainCanvas.enabled = true; UsernameText.text = PlayerPrefs.GetString("USERNAME"); MoneyText.text = PlayerPrefs.GetInt("MONEY") + " ₹"; }
public void LoadProfile(Profile profile) { Debug.Log("Attempting to Load the original profile."); ProfileCopier copier = FindObjectOfType <ProfileCopier>(); ProfileSetter setter = FindObjectOfType <ProfileSetter>(); ProfileUI UI = FindObjectOfType <ProfileUI>(); ProfileMessager messager = FindObjectOfType <ProfileMessager>(); Debug.Log("Loading profile named " + profile.Name + "."); for (int i = 0; i <= setter.CurrentProfile.DamageCharts; i++) { Debug.Log("MinM" + i + ": " + setter.CurrentProfile.MinMove[i] + " M" + i + ": " + setter.CurrentProfile.Move[i] + " WS" + i + ": " + setter.CurrentProfile.WeaponSkill[i] + " BS" + i + ": " + setter.CurrentProfile.BallisticSkill[i] + " S" + i + ": " + setter.CurrentProfile.Strength[i] + " T" + i + ": " + setter.CurrentProfile.Toughness[i] + " W" + i + ": " + setter.CurrentProfile.Wounds[i] + " A" + i + ": " + setter.CurrentProfile.Attacks[i] + " Ld" + i + ": " + setter.CurrentProfile.Leadership[i] + " Sv" + i + ": " + setter.CurrentProfile.Save[i]); } Debug.Log("Setting Damage Profiles to " + setter.CurrentProfile.DamageCharts + "."); UI.dropdownDamage.value = setter.CurrentProfile.DamageCharts; Debug.Log("Loading the current profile into the UI."); if (setter.CurrentProfile.DamageCharts == 0) { UI.ReadProfile(); } else { UI.CreateDamageProfiles(); } StartCoroutine(messager.DisplayTemporaryMessage(setter.CurrentProfile.Name + " loaded.", false)); }
/// <summary> /// Fill the given gameObject with random info, or saved info if the given index has been saved /// </summary> /// <param name="uiObject">The object to fill with info</param> /// <param name="index">The index of the tab</param> private void FillInfo(GameObject uiObject, int index) { ProfileUI pUi = uiObject.GetComponent <ProfileUI>(); ProfileInfo pInfo = ProfileInfo.GetDefault(); //If uses caching try to get value from the profiles dict if (useCaching) { //If no value is found make a new entry in the dict if (!profiles.TryGetValue(index, out pInfo)) { StartCoroutine(ProfileRandomizer.Instance.GetRandomProfileAPI(pUi, index, this)); pInfo = ProfileInfo.GetDefault(); } } else { StartCoroutine(ProfileRandomizer.Instance.GetRandomProfileAPI(pUi, index, this)); } pUi.SetInfo(pInfo); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_main); Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab); fab.Click += FabOnClick; DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, Resource.String.navigation_drawer_open, Resource.String.navigation_drawer_close); drawer.AddDrawerListener(toggle); toggle.SyncState(); NavigationView navigationView = FindViewById <NavigationView>(Resource.Id.nav_view); navigationView.SetNavigationItemSelectedListener(this); //handle fragments createTestUI = new CreateTestUI(); guessUI = new GuessUI(); statisticsUI = new StatisticsUI(); friendlistUI = new FriendlistUI(); createMessageUI = new CreateMessageUI(); profileUI = new ProfileUI(); //createTestUI = (CreateTestUI)SupportFragmentManager.FindFragmentById(Resource.Id.ct1); createTestUI.ViewModel = ((MainScreenViewModel)ViewModel).Crt; //guessUI = (GuessUI)SupportFragmentManager.FindFragmentById(Resource.Id.ct2); guessUI.ViewModel = ((MainScreenViewModel)ViewModel).Grt; //statisticsUI = (StatisticsUI)SupportFragmentManager.FindFragmentById(Resource.Id.ct3); statisticsUI.ViewModel = ((MainScreenViewModel)ViewModel).Srt; friendlistUI.ViewModel = ((MainScreenViewModel)ViewModel).Frt; createMessageUI.ViewModel = ((MainScreenViewModel)ViewModel).Cmf; profileUI.ViewModel = ((MainScreenViewModel)ViewModel).Pfv; var transaction = SupportFragmentManager.BeginTransaction(); currentFragment = profileUI; transaction.Add(Resource.Id.fragment_container, createTestUI, "createTestUI"); transaction.Add(Resource.Id.fragment_container, guessUI, "guessUI"); transaction.Add(Resource.Id.fragment_container, statisticsUI, "statisticsUI"); transaction.Add(Resource.Id.fragment_container, friendlistUI, "friendlistUI"); transaction.Add(Resource.Id.fragment_container, createMessageUI, "createMessageUI"); transaction.Add(Resource.Id.fragment_container, profileUI, "profileUI"); transaction.Hide(createMessageUI); transaction.Hide(friendlistUI); transaction.Hide(guessUI); transaction.Hide(statisticsUI); transaction.Hide(createTestUI); transaction.Commit(); }
public bool CheckFullProfile() { Debug.Log("Profile Saver has called Profile Checker for the current Profile"); ProfileMessager message = FindObjectOfType <ProfileMessager>(); ProfileUI profileUI = FindObjectOfType <ProfileUI>(); Profile profile = FindObjectOfType <ProfileSetter>().CurrentProfile; //int nTemp; Debug.Log("Profile Checker is checking Name in Profile"); Debug.Log("Current profile Name is " + profile.Name); if (profile.Name.Length == 0) { profileUI.OutputProfileError("Input Name", 0); Debug.Log("Value of Name is not legal."); message.DisplayMessage("Please enter the model's name.", true); return(false); } //nTemp = 100; for (int i = 0; i <= profile.DamageCharts; i++) { Debug.Log("Current Move is " + profile.MinMove[i]); if (profile.MinMove[i] < 0) { profileUI.OutputProfileError("Input MinM" + i, i); Debug.Log("Value of MinM" + i + " is not legal."); message.DisplayMessage("The profile may not have a negative Minimum Move.", true); return(false); } if (profile.MinMove[i] > profile.Move[i]) { profileUI.OutputProfileError("Input MinM" + i, i); Debug.Log("Value of MinM" + i + " is not legal."); message.DisplayMessage("The profile may not have a negative Minimum Move greater than its Move.", true); return(false); } } CheckForWarnings(profile, "MinM0"); for (int i = 0; i <= profile.DamageCharts; i++) { Debug.Log("Current Move is " + profile.Move[i]); if (profile.Move[i] < 0) { profileUI.OutputProfileError("Input M" + i, i); Debug.Log("Value of M" + i + " is not legal."); message.DisplayMessage("The profile may not have a negative Move.", true); return(false); } //if (nTemp < profile.Move[i]) { // Debug.Log("Warning: Value of M" + i + " is greater than value of M" + (i-1)); // message.CurrentState = ProfileMessager.State.warning; // message.MWarning = true; // message.ReturnToCurrentState(); //} //nTemp = profile.Move[i]; } CheckForWarnings(profile, "M0"); //nTemp = 0; for (int i = 0; i <= profile.DamageCharts; i++) { Debug.Log("Current Weapon Skill is " + profile.WeaponSkill[i]); if (0 > profile.WeaponSkill[i] || profile.WeaponSkill[i] > 7) { profileUI.OutputProfileError("Input WS" + i, i); message.DisplayMessage("The profile must have a Weapon Skill between 0 and 6.", true); Debug.Log("Value of WS" + i + " is not legal."); return(false); } //if (nTemp > profile.WeaponSkill[i]) { // message.CurrentState = ProfileMessager.State.warning; // message.WSWarning = true; // message.ReturnToCurrentState(); // Debug.Log("Warning: Value of WS" + i + " is better than value of WS" + (i-1)); //} //nTemp = profile.WeaponSkill[i]; } CheckForWarnings(profile, "WS0"); //nTemp = 0; for (int i = 0; i <= profile.DamageCharts; i++) { Debug.Log("Current Ballistic Skill is " + profile.BallisticSkill[i]); if (0 > profile.BallisticSkill[i] || profile.BallisticSkill[i] > 7) { profileUI.OutputProfileError("Input BS" + i, i); message.DisplayMessage("The profile must have a Ballistic Skill between 0 and 6.", true); Debug.Log("Value of BS" + i + " is not legal."); return(false); } //if (nTemp > profile.BallisticSkill[i]) { // message.CurrentState = ProfileMessager.State.warning; // message.BSWarning = true; // message.ReturnToCurrentState(); // Debug.Log("Warning: Value of BS" + i + " is better than value of BS" + (i-1)); //} //nTemp = profile.BallisticSkill[i]; CheckForWarnings(profile, "BS0"); } //nTemp = 100; for (int i = 0; i <= profile.DamageCharts; i++) { Debug.Log("Current Strength is " + profile.Strength[i]); if (profile.Strength[i] < 0) { profileUI.OutputProfileError("Input S" + i, i); message.DisplayMessage("The profile may not have a negative Strength.", true); Debug.Log("Value of S" + i + " is not legal."); return(false); } //if (nTemp < profile.Strength[i]) { // message.CurrentState = ProfileMessager.State.warning; // message.SWarning = true; // message.ReturnToCurrentState(); // Debug.Log("Warning: Value of S" + i + " is greater than value of S" + (i-1)); //} //nTemp = profile.Strength[i]; } CheckForWarnings(profile, "S0"); //nTemp = 20; for (int i = 0; i <= profile.DamageCharts; i++) { Debug.Log("Current Toughness is " + profile.Toughness[i]); if (profile.Toughness[i] < 1) { profileUI.OutputProfileError("Input T" + i, i); message.DisplayMessage("The profile must have a non zero Toughness.", true); Debug.Log("Value of T" + i + " is not legal."); return(false); } //if (nTemp < profile.Toughness[i]) { // message.CurrentState = ProfileMessager.State.warning; // message.TWarning = true; // message.ReturnToCurrentState(); // Debug.Log("Warning: Value of T" + i + " is better than value of T" + (i-1)); //} //nTemp = profile.Toughness[i]; } CheckForWarnings(profile, "T0"); //nTemp = 100; for (int i = 0; i <= profile.DamageCharts; i++) { Debug.Log("Current Wounds is " + profile.Wounds[i]); if (profile.Wounds[i] < 1) { profileUI.OutputProfileError("Input W" + i, i); message.DisplayMessage("The profile may not have zero Wounds.", true); Debug.Log("Value of W" + i + " is not legal."); return(false); } //if (nTemp <= profile.Wounds[i]) { // message.DisplayMessage("Wounds must decrease with each damage chart.", true); // Debug.Log("Value of W must decrease at each damage level."); // return false; //} //nTemp = profile.Wounds[i]; } bool error = CheckForWarnings(profile, "W0"); if (error) { return(false); } //nTemp = 20; for (int i = 0; i <= profile.DamageCharts; i++) { Debug.Log("Current Attacks is " + profile.Attacks[i]); if (profile.Attacks[i] < 0) { profileUI.OutputProfileError("Input A" + i, i); message.DisplayMessage("The profile may not have a negative number of Attacks.", true); Debug.Log("Value of A" + i + " is not legal."); return(false); } //if (nTemp < profile.Attacks[i]) { // message.CurrentState = ProfileMessager.State.warning; // message.AWarning = true; // message.ReturnToCurrentState(); // Debug.Log("Warning: Value of A" + i + " is greater than value of A" + (i-1)); //} //nTemp = profile.Attacks[i]; } CheckForWarnings(profile, "A0"); //nTemp = 20; for (int i = 0; i <= profile.DamageCharts; i++) { Debug.Log("Current Leadership is " + profile.Leadership[i]); if (profile.Leadership[i] < 0) { profileUI.OutputProfileError("Input Ld" + i, i); message.DisplayMessage("The profile may not have a negative Leadership.", true); Debug.Log("Value of Ld" + i + " is not legal."); return(false); } //if (nTemp < profile.Leadership[i]) { // message.CurrentState = ProfileMessager.State.warning; // message.LdWarning = true; // message.ReturnToCurrentState(); // Debug.Log("Warning: Value of Ld" + i + " is greater than value of Ld" + (i-1)); //} //nTemp = profile.Leadership[i]; } CheckForWarnings(profile, "Ld0"); //nTemp = 0; for (int i = 0; i <= profile.DamageCharts; i++) { Debug.Log("Current Save is " + profile.Save[i]); if (0 > profile.Save[i] || profile.Save[i] > 7) { profileUI.OutputProfileError("Input Sv" + i, i); message.DisplayMessage("The profile must have a Save between 0 and 6.", true); Debug.Log("Value of Sv" + i + " is not legal."); return(false); } //if (nTemp > profile.Save[i]) { // message.CurrentState = ProfileMessager.State.warning; // message.SvWarning = true; // message.ReturnToCurrentState(); // Debug.Log("Warning: Value of Sv" + (i) + " is better than value of Sv" + (i-1)); //} //nTemp = profile.Save[i]; } CheckForWarnings(profile, "Sv0"); //Debug //for (int i = 0; i < profile.Toughness.Count; i++) { // Debug.Log("T" + i + ": " + profile.Toughness[i]); //} return(true); }
public void CheckValue(string value) { ProfileMessager message = FindObjectOfType <ProfileMessager>(); ProfileUI profileUI = GetComponent <ProfileUI>(); if (profileName == "Name") { Debug.Log("Checking profile Name from Profile Value Checker."); if (value.Length > 0) { Debug.Log("Saving Name, " + value + ", to Profile."); profileUI.SetColor(profileName, true); setter.SetProfile(profileName, value); message.ReturnToCurrentState(); } else { profileUI.SetColor(profileName, false); message.DisplayMessage("Value of " + profileName + " is not legal.", true); Debug.Log("Value of " + profileName + " is not legal."); } } else { int nValue = ReadIntString(value); bool valueChecks = false; Debug.Log("Profile Value Checker is checking a numeric Profile: " + profileName); switch (profileName) { case "MinM0": case "MinM1": case "MinM2": case "MinM3": case "MinM4": case "M0": case "M1": case "M2": case "M3": case "M4": case "S0": case "S1": case "S2": case "S3": case "S4": case "A0": case "A1": case "A2": case "A3": case "A4": case "Ld0": case "Ld1": case "Ld2": case "Ld3": case "Ld4": valueChecks = (nValue >= 0); break; case "T0": case "T1": case "T2": case "T3": case "T4": case "W0": case "W1": case "W2": case "W3": case "W4": valueChecks = (nValue > 0); break; case "WS0": case "WS1": case "WS2": case "WS3": case "WS4": case "BS0": case "BS1": case "BS2": case "BS3": case "BS4": case "Sv0": case "Sv1": case "Sv2": case "Sv3": case "Sv4": valueChecks = (0 <= nValue && nValue <= 7); break; default: break; } if (valueChecks) { Debug.Log("Profile Value Checker is saving a numeric profile to Profile: " + profileName); profileUI.SetColor(profileName, valueChecks); setter.SetProfile(profileName, nValue); CheckForWarnings(setter.CurrentProfile, profileName); } else { profileUI.SetColor(profileName, valueChecks); message.DisplayMessage("Value of " + profileName + " is not legal.", true); Debug.Log("Value of " + profileName + " is not legal."); } } }
public void Close() { ProfileUI ui = FindObjectOfType <ProfileUI>(); ui.Close(ProfileUI.CloseType.loadPanelClose); }
public void DisplayProfile() { MainUI.SetActive(false); ProfileUI.SetActive(true); }
public CoreUI(OpCore core) { Core = core; // load menus for loaded services foreach (var service in Core.ServiceMap.Values) { var id = service.ServiceID; if (id == ServiceIDs.Board) { Services[id] = new BoardUI(this, service); } if (id == ServiceIDs.Buddy) { Services[id] = new BuddyUI(this, service); } if (id == ServiceIDs.Chat) { Services[id] = new ChatUI(this, service); } if (id == ServiceIDs.IM) { Services[id] = new IMUI(this, service); } if (id == ServiceIDs.Mail) { Services[id] = new MailUI(this, service); } if (id == ServiceIDs.Plan) { Services[id] = new PlanUI(this, service); } if (id == ServiceIDs.Profile) { Services[id] = new ProfileUI(this, service); } if (id == ServiceIDs.Share) { Services[id] = new ShareUI(this, service); } if (id == ServiceIDs.Storage) { Services[id] = new StorageUI(this, service); } if (id == ServiceIDs.Trust) { Services[id] = new TrustUI(this, service); } } Core.RunInGui += Core_RunInGui; Core.UpdateConsole += Core_UpdateConsole; Core.ShowConfirm += Core_ShowConfirm; Core.ShowMessage += Core_ShowMessage; Core.VerifyPass += Core_VerifyPass; Core_UpdateConsole("DeOps " + Application.ProductVersion); }
// Use this for initialization void Start() { pui = GetComponent <ProfileUI>(); //SceneManager.LoadScene ("Game", LoadSceneMode.Additive); }
// Use this for initialization void Start() { ui = FindObjectOfType <ProfileUI>(); Assert.IsNotNull(ui, "Name Check Panel could not locate Profile UI."); }
// Use this for initialization void Start() { pui = GetComponent <ProfileUI>(); ProfileController.procon.Load(); }
// Use this for initialization void Start() { com = GetComponent <Computer>(); pui = GetComponent <ProfileUI>(); ep = GetComponent <ErrorProm>(); }
// Use this for initialization void Start() { pui = GetComponent <ProfileUI>(); }