void getOnAndroid_click() { var url = buttonLink; win.ShowWindow(() => GuiClasses.TextField("Copy Link:", url)); Loader.OpenUrl(url); }
public void Update() { if (win.enabled) { return; } var intersectRay = Intersects(renderer); tr.localScale = Vector3.Lerp(tr.localScale, intersectRay && !Input.GetMouseButton(0) ? defScale * 1.2f : defScale, Time.deltaTime * 5); if (intersectRay && Input.GetKeyDown(KeyCode.Mouse0)) { if (settings.showAllStats) { PhotonNetwork.player.stats.moneyFound += 1; } clicked = this; if (click != null) { print(click.Method.Name); GuiClasses.PlayPushButton(); click(); } } }
public void DrawStats() { bs.win.windowTitle = "Statics for " + name; GuiClasses.Label("ID".PadRight(20) + ID); if (GuiClasses.Button("ShowADvStats")) { bs.win.ShowWindow(delegate { gui.Label(ToString2()); }); } var gameType = Enum.GetNames(typeof(GameTypeEnum)); if (stats.moneyFound > 0) { GuiClasses.TextField("found", stats.moneyFound.ToString()); } for (int i = 0; i < gameType.Length; i++) { gui.BeginVertical(gameType[i], GUI.skin.window); var gts = stats.games[i]; gts.DrawStats(); gui.EndVertical(); } if (bs._Game) { gui.BeginVertical(bs.previousRoom.gameType.ToString(), GUI.skin.window); curGame.DrawStats(); gui.EndVertical(); } }
public void DrawStats() { gui.BeginHorizontal(); var GetValue = new Action <Func <Score, string>, string>((ac, title) => { var h = gui.Height(20); gui.BeginVertical(); gui.Label(GuiClasses.Tr(title), new GUIStyle(GUI.skin.label) { wordWrap = false }); foreach (var a in scores.Where(a => a.value > 0 || bs.settings.showAllStats)) { gui.Label(ac(a), h); } gui.EndVertical(); }); GetValue(a => a.name, ""); GetValue(a => a.value + "x" + a.points, ""); GetValue(a => (a.value * a.points) + "$", ""); gui.EndHorizontal(); if (GetMoney() > 0 || bs.settings.showAllStats) { GuiClasses.TextField("total:", GetMoney() + "$"); } }
public static float HorizontalSlider2(string Name, float P1, float Left, float Right, bool scrollbar) { if (scrollbar) { return(GuiClasses.HorizontalSlider(Name, P1, Left, Right)); } return(float.Parse(GuiClasses.TextField(Name, P1.ToString()))); }
public void ShowCarPhys() { ShowWindow(delegate { win.windowSkin = settings.unitySkin; _Player.varParse.filter = GuiClasses.TextField("Search:", _Player.varParse.filter); _Player.varParse.UpdateValues(); }); //room.Set("dsad","sdads"); }
public void OnGUI() { if (www == null) { www = new WWW(""); } GUILayout.Label("Version:" + version + " Pkg:" + setting.packageVersion); if (packageMap != null) { GUILayout.Label("Package " + packageMap.version); } GUI.skin = loadingBar; GUILayout.BeginArea(new Rect(Screen.width / 2f - (x / 2), Screen.height / 2f - 50, x, 600)); if (newVersionAvaible) { loadingBar.window.wordWrap = true; if (GUILayout.Button(newVersionAvaibleText, loadingBar.window, GUILayout.MinHeight(100))) { Application.OpenURL(newVersionAvaibleText.Substring(newVersionAvaibleText.IndexOf("http", System.StringComparison.Ordinal))); } } else { GUI.skin.label.alignment = TextAnchor.MiddleCenter; var progress = (www.progress / 2f) + halfDownloaded; loadingBar.horizontalSliderThumb.fixedWidth = Mathf.Clamp(progress * (x - 10), 35, x - 10); GUILayout.HorizontalSlider(0, 0, 1); GUILayout.Label(GuiClasses.Tr("Loading ") + (int)(progress * 100) + "%"); GUILayout.Label(loadingText, loadingBar.window); GUI.skin.box.wordWrap = true; if (!string.IsNullOrEmpty(www.error)) { GUILayout.Box(www.error); //Retry(); } else if (!string.IsNullOrEmpty(error)) { GUILayout.Box(error); //Retry(); } } GUILayout.EndArea(); }
public void DrawChat() { var skin = bs._Loader.skin; var l = bs._Loader; if (mapChat == null) { mapChat = GuiClasses.Tr(def) + "\n"; bs.Download(bs.mainSite + "chat/" + room + ".txt", delegate(string s, bool b) { if (b) { mapChat += s; } chatScroll = new Vector2(0, 10000); }, false); } skin.label.alignment = TextAnchor.UpperLeft; chatScroll = GUILayout.BeginScrollView(chatScroll, bs.win.editorSkin.box); skin.textField.wordWrap = true; skin.label.wordWrap = true; GUILayout.Label(mapChat, GUILayout.ExpandHeight(true)); GUILayout.EndScrollView(); GUILayout.BeginHorizontal(); if (Event.current.keyCode == KeyCode.Return && Event.current.isKey) { Event.current.Use(); } mapChatInput = GUILayout.TextField(mapChatInput, 200); if ((l.Button("Send", false)) && Time.realtimeSinceStartup - sendTime > 5 && !string.IsNullOrEmpty(mapChatInput.Trim())) { string prms = l.playerNamePrefixed + ": " + mapChatInput.Trim().Replace(":", "-"); //if(bs.online) //bs._GameGui.Chat(bs._Player.playerNameClan + ":" + mapChatInput); bs.Download(bs.mainSite + "scripts/chatSend.php", null, true, "map", room, "send", prms); mapChat += "\n" + prms; sendTime = Time.realtimeSinceStartup; mapChatInput = ""; chatScroll = new Vector2(0, 10000); } GUILayout.EndHorizontal(); }
public static object DrawValue(object v, Field a) { var name = a.Name; if (v is int) { v = (int)HorizontalSlider2(name, (int)v, a.left, a.right, a.scrollbar); } else if (v is float) { v = HorizontalSlider2(name, (float)v, a.left, a.right, a.scrollbar); } else if (v is bool) { v = GuiClasses.Toggle((bool)v, name); } else if (v is string) { v = GuiClasses.TextField(name, (string)v); } return(v); }
public void Start2() { if (_Loader.mapWWW != null && !Application.isEditor) { print("Unloading assets"); if (_Loader.mapWWW.assetBundle != null) { _Loader.mapWWW.assetBundle.Unload(false); } _Loader.mapWWW.Dispose(); _Loader.mapWWW = null; } //if (previousRoom == null && isDebug) // previousRoom = new RoomInfo("", null); if (photonPlayer != null && photonPlayer.curGame.GetMoney() > 0) { var g = photonPlayer.curGame; win.ShowWindow(delegate { win.windowTitle = previousRoom.gameType.ToString(); win.showBackButton = false; g.DrawStats(); if (GuiClasses.Button("Claim")) { photonPlayer.stats.games[(int)previousRoom.gameType].Add(g); photonPlayer.varParse.UpdateValues(); GuiClasses.CloseWindow(); } }); photonPlayer.stats.curGame = new Gts(); } //if (string.IsNullOrEmpty(playerName)) // ShowWindow(EnterPlayerNickName); }
private void UpdateValues(object obs, string key = "", HashSet <object> antiloop = null, Field oldAtr = null) { var isgui = Event.current != null; if (isgui) { GuiClasses.Indent(); } if (antiloop == null) { antiloop = new HashSet <object>(); } const BindingFlags flags = BindingFlags.Public | BindingFlags.Instance; if (obs == null) { throw new NullReferenceException(); } var obsType = obs.GetType(); foreach (FieldInfo fi in obsType.GetFields(flags)) { id++; var varCache = values[id]; if (varCache == null) { var atr2 = (Field)fi.GetCustomAttributes(true).Union(obsType.GetCustomAttributes(true)).FirstOrDefault(b => b is Field) ?? oldAtr; varCache = values[id] = new VarCache { atr = atr2, curKey = key + "/" + fi.Name, fi = fi, obs = obs }; superVars[varCache.curKey] = varCache; } var atr = varCache.atr; if (atr == null || atr.ignore) { continue; } if (atr.Name == null || Equals(atr, oldAtr)) { atr.Name = fi.Name; } var curKey = varCache.curKey; var curValue = fi.GetValue(obs); if (!string.IsNullOrEmpty(fi.FieldType.Namespace)) { atr.save2 = atr.save && (pl == null || pl.isLocal) && (bs.room == null || PhotonNetwork.isMasterClient); if (varCache.isSet) { if (!Equals(varCache.value, curValue)) { OnValueSet(curKey, curValue, atr.save2); } } else if (atr.save2) { curValue = PlayerPrefGet(curValue, curKey); } if (pl != null) { pl.customProperties.TryGetValue2(curKey, ref curValue); } if (roomInfo != null) { roomInfo.customProperties.TryGetValue2(curKey, ref curValue); } varCache.value = curValue; varCache.isSet = true; if (isgui && !atr.dontDraw && (filter == "" || atr.Name.ToLower().Contains(filter))) { var drawValue = DrawValue(curValue, atr); if ((roomInfo == null || PhotonNetwork.isMasterClient) && (pl == null || pl.isLocal)) { curValue = drawValue; } } fi.SetValue(obs, curValue); } else if (curValue != null && antiloop.Add(curValue)) { if (isgui && !GuiClasses.BeginVertical(atr.Name, false)) { continue; } UpdateValues(curValue, curKey, antiloop, atr.recursive ? atr : null); if (isgui) { gui.EndVertical(); } } } if (isgui) { GuiClasses.UnIndent(); } }