///<summary>PlayerSettings-г бөглөнө</summary> public static void PlayerSettingsChange() { #if UNITY_EDITOR PlayerSettings.companyName = GC.companyName; PlayerSettings.productName = GC.productName; int lastDotIdx = GC.companyWebSite.LastIndexOf('.'); PlayerSettings.applicationIdentifier = GC.companyWebSite.SubStr(lastDotIdx + 1, GC.companyWebSite.Length - lastDotIdx - 1) + "." + GC.companyWebSite.SubStr(0, lastDotIdx) + "." + Rgx.Replace(GC.productName, "\\s+", "").ToLower(); PlayerSettings.bundleVersion = GC.version; Texture2D[] icons = new Texture2D[] { GC.icon }; PlayerSettings.SetIconsForTargetGroup(BuildTargetGroup.Unknown, icons); PlayerSettings.SplashScreen.show = false; PlayerSettings.SplashScreen.logos = null; Texture2D iphone = GC.iPhoneLaunchScreen, ipad = GC.iPadLaunchScreen; PlayerSettings.iOS.SetiPhoneLaunchScreenType(iOSLaunchScreenType.ImageAndBackgroundRelative); PlayerSettings.iOS.SetLaunchScreenImage(iphone, iOSLaunchScreenImageType.iPhonePortraitImage); PlayerSettings.iOS.SetiPadLaunchScreenType(iOSLaunchScreenType.ImageAndBackgroundRelative); PlayerSettings.iOS.SetLaunchScreenImage(ipad, iOSLaunchScreenImageType.iPadImage); PlayerSettings.SplashScreen.show = true; if (iphone) { PlayerSettings.SplashScreen.background = TexSpr(iphone); } #endif }
///<summary>string [hex] => Color</summary> public static Color HexCol(string a) { if (Rgx.IsMatch(a.ToUpper(), Rgx.HexColor)) { Color res; if (ColorUtility.TryParseHtmlString(a[0] != '#' ? "#" + a : a, out res)) { return(res); } } return(Color.clear); }
public void Process(string Text) { ProcessCommand(Rgx.Parse(Text, "^\\[(.*?):(.*?):(.*?)\\] \\[Server thread\\/INFO\\]: [<|\\[](.*?)[>|\\]] !(.*?)$", false)); if (Rgx.Contains(Text, "^\\[(.*?):(.*?):(.*?)\\] \\[Server thread\\/INFO\\]: Saving players$", false)) { Sys.Ref.Save(); } if (Rgx.Contains(Text, "^\\[(.*?):(.*?):(.*?)\\] \\[Server thread\\/INFO\\]: Stopping server$", false)) { Sys.Ref.Running = false; } var JoinedMatches = Rgx.Parse(Text, "^\\[(.*?):(.*?):(.*?)\\] \\[Server thread\\/INFO\\]: (.*?) joined the game$", false); foreach (var JoinedMatch in JoinedMatches) { Players.Get(JoinedMatch[3]).Online = true; if (Players.Get(JoinedMatch[3]).PlayedBefore == false) { NBT TellRaw = new NBT(); TellRaw["text"] = JoinedMatch[3] + Str.Tr(" впервые подключи(лся)/(лась) на сервер"); TellRaw["color"] = "aqua"; RCON.Command("tellraw", "@a", TellRaw.ToString()); RCON.Command("recipe give", JoinedMatch[3], "*"); RCON.Command("recipe take", JoinedMatch[3], "minecraft:tnt"); RCON.Command("recipe take", JoinedMatch[3], "minecraft:tnt_minecart"); Players.Get(JoinedMatch[3]).PlayedBefore = true; NBT NewTellRaw = new NBT(); NewTellRaw["text"] = Str.Tr("Приветствуем тебя на нашем сервере Unary Vanilla Server!\nПрочитай все таблички вокруг тебя и начинай игру"); NewTellRaw["color"] = "light_green"; RCON.Command("tellraw", JoinedMatch[3], NewTellRaw.ToString()); continue; } } var LeftMatches = Rgx.Parse(Text, "^\\[(.*?):(.*?):(.*?)\\] \\[Server thread\\/INFO\\]: (.*?) left the game$", false); foreach (var LeftMatch in LeftMatches) { Players.Get(LeftMatch[3]).Online = false; } }
public void Execute(string PlayerName, params object[] Arguments) { string PositionString = RCON.Command("data get entity", PlayerName, "Pos"); var Result = Rgx.Parse(PositionString, ": \\[(.*?)d, (.*?)d, (.*?)d\\]"); int X = Convert.ToInt32(JsonConvert.DeserializeObject <double>(Result[0][0])); int Y = Convert.ToInt32(JsonConvert.DeserializeObject <double>(Result[0][1])); int Z = Convert.ToInt32(JsonConvert.DeserializeObject <double>(Result[0][2])); Players.Get(PlayerName).Home = new Position <int>(X, Y, Z); NBT TellRaw = new NBT(); TellRaw["text"] = Str.Tr("Успешно установили дом на ") + Players.Get(PlayerName).Home.ToString(); TellRaw["color"] = "green"; RCON.Command("tellraw", PlayerName, TellRaw.ToString()); }
public void Init() { string PlayerList = Sys.Ref.Get <RCON>().Command("list"); var Matches = Rgx.Parse(PlayerList, "^There are (.*?) of a max (.*?) players online: (.*?)$"); string NewPlayers = Matches[0][2]; NewPlayers = NewPlayers.Replace(",", ""); if (!NewPlayers.Contains(' ')) { Get(NewPlayers).Online = true; } else { string[] NewOnlinePlayers = NewPlayers.Split(' '); foreach (var NewOnlinePlayer in NewOnlinePlayers) { Get(NewOnlinePlayer).Online = true; } } }
///<summary>pattern-г replacement-р дарна</summary> public static string RgxReplace(this string a, string pattern, string replacement) { return(Rgx.Replace(a, pattern, replacement)); }
///<summary>pattern-тай таарч байна уу шалгана</summary> public static bool RgxIsMatch(this string a, string pattern) { return(Rgx.IsMatch(a, pattern)); }
///<summary>үгийг салгаж авна</summary> public static string[] RgxSplitWord(this string a) { return(Rgx.Split(a, "\\W+")); }
///<summary>pattern-р хуваана</summary> public static string[] RgxSplit(this string a, string pattern) { return(Rgx.Split(a, pattern)); }
///<summary>зайг арилгана</summary> public static string RmvWhiteSpace(this string a) { return(Rgx.Replace(a, "\\s+", "")); }
///<summary>file-г regex хийнэ</summary> public static void FileReplaceStrings(string path, string regex, string replace) { CrtFile(path, Rgx.Replace(ReadFile(path), regex, replace)); }