IEnumerator Post(string url, string bodyJsonString) { var request = new UnityWebRequest(url, "POST"); byte[] bodyRaw = Encoding.UTF8.GetBytes(bodyJsonString); request.uploadHandler = (UploadHandler) new UploadHandlerRaw(bodyRaw); request.downloadHandler = (DownloadHandler) new DownloadHandlerBuffer(); request.SetRequestHeader("Content-Type", "application/json"); yield return(request.Send()); Debug.Log("Status Code: " + request.responseCode); // error.text = request.responseCode.ToString(); if (request.responseCode == 200) { CurrntUI.SetActive(false); TargetUI.SetActive(true); Email.text = ""; pass.text = ""; User.text = ""; Cpass.text = ""; } if (request.responseCode != 200) { errorText.SetActive(true); error.text = "Something Went Wrong"; } }
void Start() { if (PlayerPrefs.GetString("Login") == "Login") { CurrntUI.SetActive(false); TargetUI.SetActive(true); } }
public static void Attach(Main main, Entity entity, UIRenderer ui, Property <float> health, Property <float> rotation, Property <bool> noteActive, Property <bool> phoneActive) { Sprite damageOverlay = new Sprite(); damageOverlay.Image.Value = "Images\\damage"; damageOverlay.AnchorPoint.Value = new Vector2(0.5f); ui.Root.Children.Add(damageOverlay); // Center the damage overlay and scale it to fit the screen damageOverlay.Add(new Binding <Vector2, Point>(damageOverlay.Position, x => new Vector2(x.X * 0.5f, x.Y * 0.5f), main.ScreenSize)); damageOverlay.Add(new Binding <Vector2>(damageOverlay.Scale, () => new Vector2(main.ScreenSize.Value.X / damageOverlay.Size.Value.X, main.ScreenSize.Value.Y / damageOverlay.Size.Value.Y), main.ScreenSize, damageOverlay.Size)); damageOverlay.Add(new Binding <float, float>(damageOverlay.Opacity, x => 1.0f - x, health)); #if VR if (main.VR) { VirtualReticle reticleController = entity.GetOrCreate <VirtualReticle>(); reticleController.Add(new Binding <float>(reticleController.Rotation, rotation)); ModelNonPostProcessed reticle = entity.Create <ModelNonPostProcessed>(); reticle.Filename.Value = "Models\\plane"; reticle.EffectFile.Value = "Effects\\VirtualUI"; reticle.DiffuseTexture.Value = "Images\\reticle"; reticle.Add(new Binding <Matrix>(reticle.Transform, reticleController.Transform)); reticle.Add(new Binding <bool>(reticle.Enabled, () => !main.Paused && !phoneActive && !noteActive, main.Paused, phoneActive, noteActive)); } else #endif { Sprite reticle = new Sprite(); reticle.Image.Value = "Images\\reticle"; reticle.AnchorPoint.Value = new Vector2(0.5f); reticle.Opacity.Value = 0.5f; ui.Root.Children.Add(reticle); reticle.Add(new Binding <bool>(reticle.Visible, main.Settings.EnableReticle)); // Center the reticle reticle.Add(new Binding <Vector2, Point>(reticle.Position, x => new Vector2(x.X * 0.5f, x.Y * 0.5f), main.ScreenSize)); } UIComponent targets = new UIComponent(); ui.Root.Children.Add(targets); TargetUI targetUi = entity.GetOrCreate <TargetUI>(); targetUi.Add(new ListBinding <UIComponent>(targetUi.Sprites, targets.Children)); targets.Add(new ListBinding <UIComponent, Transform>(targets.Children, TargetFactory.Positions, delegate(Transform target) { Sprite sprite = new Sprite(); sprite.Image.Value = "Images\\target"; sprite.AnchorPoint.Value = new Vector2(0.5f, 0.5f); sprite.UserData.Value = target; sprite.Add(new Binding <bool>(sprite.Visible, target.Enabled)); return(sprite); })); }
private void Awake() { targetUI = FindObjectOfType <TargetUI>(); if (lockOn) { targetUI.gameObject.SetActive(false); } else { targetUI.gameObject.SetActive(true); } }
public void OnSubmit() { logdata user = new logdata(); //user.username = User.text; // user.passward = pass.text; // jsonString = JsonUtility.ToJson(user); CurrntUI.SetActive(false); TargetUI.SetActive(true); Debug.Log(usernane); Debug.Log(passWard); jsonString = "{ \"password\": \"" + pass.text + "\", \"username\": \"" + User.text + "\"}"; Debug.Log(jsonString); StartCoroutine(Post(url, jsonString)); }
public void OnDropCompleted(IDataObject obj, Point dropPoint) { var chatWindow = TargetUI.GetVisualParent <ChatWindow>(); if (chatWindow != null) { if (obj.GetDataPresent(DataFormats.FileDrop)) { chatWindow.SendFiles(obj.GetData(DataFormats.FileDrop) as string[]); } else { var item = GetContact(obj); var buddy = item.DataContext as Buddy; chatWindow.Invite(buddy); } } }
private void ShowSearchOption() { if (pathList.Count > 0) { EditorGUILayout.BeginHorizontal(); { EditorGUIUtility.labelWidth = 100f; GUILayout.Label("請選擇 Layer 更新模式", GUILayout.Width(200f)); targetMode = (TargetUI)EditorGUILayout.EnumPopup(targetMode); updateMissing = EditorGUILayout.Toggle("是否需要修正遺失", updateMissing); EditorGUIUtility.labelWidth = 50f; } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); { if (GUILayout.Button("全選", GUILayout.Width(60f))) { for (int i = 0; i < selectedList.Count; i++) { selectedList[i] = true; } } if (GUILayout.Button("取消全選", GUILayout.Width(60f))) { for (int i = 0; i < selectedList.Count; i++) { selectedList[i] = false; } } if (GUILayout.Button("反向選取", GUILayout.Width(60f))) { for (int i = 0; i < selectedList.Count; i++) { selectedList[i] = !selectedList[i]; } } } EditorGUILayout.EndHorizontal(); } }
public UIElement GetTopContainer() { UIElement container = null; if (TargetUI != null) { var window = TargetUI.GetVisualParent <Window>(); if (window != null) { container = (UIElement)window.Content; } } if (container == null) { container = (UIElement)Application.Current.MainWindow.Content; } return(container); }
public static void Attach(Main main, Entity entity, UIRenderer ui, Property <float> health, Property <float> rotation, Property <bool> noteActive, Property <bool> phoneActive, Property <Vector3> linearVelocity, Property <bool> enableDebugVelocity) { Sprite damageOverlay = new Sprite(); damageOverlay.Image.Value = "Images\\damage"; damageOverlay.AnchorPoint.Value = new Vector2(0.5f); ui.Root.Children.Add(damageOverlay); // Center the damage overlay and scale it to fit the screen damageOverlay.Add(new Binding <Vector2, Point>(damageOverlay.Position, x => new Vector2(x.X * 0.5f, x.Y * 0.5f), main.ScreenSize)); damageOverlay.Add(new Binding <Vector2>(damageOverlay.Scale, () => new Vector2(main.ScreenSize.Value.X / damageOverlay.Size.Value.X, main.ScreenSize.Value.Y / damageOverlay.Size.Value.Y), main.ScreenSize, damageOverlay.Size)); damageOverlay.Add(new Binding <float, float>(damageOverlay.Opacity, x => 1.0f - x, health)); Container debugVelocityContainer = main.UIFactory.CreateContainer(); debugVelocityContainer.Opacity.Value = UIFactory.Opacity; debugVelocityContainer.AnchorPoint.Value = new Vector2(1.0f, 0.0f); bool vr = false; #if VR vr = main.VR; #endif debugVelocityContainer.Add(new Binding <Vector2, Point>(debugVelocityContainer.Position, x => new Vector2(x.X * 0.9f, x.Y * (vr ? 0.7f : 0.9f)), main.ScreenSize)); debugVelocityContainer.Add(new Binding <bool>(debugVelocityContainer.Visible, enableDebugVelocity)); ui.Root.Children.Add(debugVelocityContainer); ListContainer debugVelocityList = new ListContainer(); debugVelocityList.Orientation.Value = ListContainer.ListOrientation.Vertical; debugVelocityContainer.Children.Add(debugVelocityList); TextElement debugVelocity = main.UIFactory.CreateLabel(); debugVelocity.Add(new Binding <string, Vector3>(debugVelocity.Text, x => Math.Abs(x.Y).ToString("00.00"), linearVelocity)); debugVelocityList.Children.Add(debugVelocity); TextElement debugHorizontalVelocity = main.UIFactory.CreateLabel(); debugHorizontalVelocity.Add(new Binding <string, Vector3>(debugHorizontalVelocity.Text, x => { x.Y = 0.0f; return(x.Length().ToString("00.00")); }, linearVelocity)); debugVelocityList.Children.Add(debugHorizontalVelocity); #if VR if (main.VR) { VirtualReticle reticleController = entity.GetOrCreate <VirtualReticle>(); reticleController.Add(new Binding <float>(reticleController.Rotation, rotation)); ModelNonPostProcessed reticle = entity.Create <ModelNonPostProcessed>(); reticle.Filename.Value = "Models\\plane"; reticle.EffectFile.Value = "Effects\\VirtualUI"; reticle.DiffuseTexture.Value = "Images\\reticle"; reticle.Add(new Binding <Matrix>(reticle.Transform, reticleController.Transform)); reticle.Add(new Binding <bool>(reticle.Enabled, () => !main.Paused && !phoneActive && !noteActive && main.Settings.EnableReticleVR, main.Paused, phoneActive, noteActive, main.Settings.EnableReticleVR)); } else #endif { Sprite reticle = new Sprite(); reticle.Image.Value = "Images\\reticle"; reticle.AnchorPoint.Value = new Vector2(0.5f); reticle.Opacity.Value = 0.5f; ui.Root.Children.Add(reticle); reticle.Add(new Binding <bool>(reticle.Visible, main.Settings.EnableReticle)); // Center the reticle reticle.Add(new Binding <Vector2, Point>(reticle.Position, x => new Vector2(x.X * 0.5f, x.Y * 0.5f), main.ScreenSize)); } UIComponent targets = new UIComponent(); ui.Root.Children.Add(targets); TargetUI targetUi = entity.GetOrCreate <TargetUI>(); targetUi.Add(new ListBinding <UIComponent>(targetUi.Sprites, targets.Children)); targets.Add(new ListBinding <UIComponent, Transform>(targets.Children, TargetFactory.Positions, delegate(Transform target) { Sprite sprite = new Sprite(); sprite.Image.Value = "Images\\target"; sprite.AnchorPoint.Value = new Vector2(0.5f, 0.5f); sprite.UserData.Value = target; sprite.Add(new Binding <bool>(sprite.Visible, () => target.Enabled && main.Settings.EnableWaypoints, target.Enabled, main.Settings.EnableWaypoints)); return(sprite); })); }