Иконка ресурса

FREE WNot : 0.0.1 0.0.1

Нет прав для скачивания
C#:
using System.Linq;
using System.Text;

using Newtonsoft.Json;
using Oxide.Core;
using Oxide.Game.Rust.Cui;
using System.Collections.Generic;
using Oxide.Core.Plugins;
using UnityEngine;



namespace Oxide.Plugins
{
    [Info("UI NOTIFI", "WOLF#4002", "0.0.1")]
    public class WNot : RustPlugin
    {
		
        [PluginReference] Plugin ImageLibrary;
        private new void LoadDefaultMessages()
		{
			lang.RegisterMessages(new Dictionary<string, string>
			{
				["Welcom"] = "WELCOME",
				["Online"] = "{0}   [{1}] \nOnline [{2}] Sleepers [{3}]",
				
			}, this, "eu");
			lang.RegisterMessages(new Dictionary<string, string>
			{
				["Welcom"] = "ДОБРО ПОЖАЛОВАТЬ",
				["Online"] = "{0}   [{1}] \nОнлайн [{2}] Спящие [{3}]",
				
			}, this, "ru");
			lang.RegisterMessages(new Dictionary<string, string>
			{
				["Welcom"] = "ЛАСКАВО ПРОСИМО",
				["Online"] = "{0}   [{1}] \nОнлайн [{2}] Сплячі [{3}]",
			}, this, "uk");
			PrintWarning("\nМовний файл завантажено успішно\nЯзыковой файл загружен успешно\nLanguage file uploaded successfully");
		}
		public static StringBuilder sb = new StringBuilder();
        public string GetLang(string LangKey, string userID = null, params object[] args)
        {
            sb.Clear();
            if (args != null)
            {
                sb.AppendFormat(lang.GetMessage(LangKey, this, userID), args);
                return sb.ToString();
            }
            return lang.GetMessage(LangKey, this, userID);
        }
		
		
		
		private void OnServerInitialized()  
		{
			ImageLibrary.Call("AddImage", "https://rustplugins.top/api/image/menu/noti.png", "jh");
			BasePlayer.activePlayerList.ToList().ForEach(OnPlayerConnected);
		}
		private void OnPlayerConnected(BasePlayer player)
		{
			
			Notifi(player, GetLang("Welcom",player.UserIDString), GetLang("Online",player.UserIDString, player.displayName, player.userID, BasePlayer.activePlayerList.Count, BasePlayer.sleepingPlayerList.Count.ToString())); 
		}
		private void OnPlayerDisconnected(BasePlayer player)
        {
            CuiHelper.DestroyUi(player, Not);
        }
		private void Unload()
		{
			foreach (var player in BasePlayer.activePlayerList)
			{
				CuiHelper.DestroyUi(player, Not);
			}
		}
		
		private static string Not = "UI_Not";
		void Notifi(BasePlayer player, string title ,string msg, string comm = null)
		{
			CuiElementContainer container = new CuiElementContainer();
			CuiHelper.DestroyUi(player, Not);
			container.Add(new CuiPanel
                {
                    
                    RectTransform = { AnchorMin = "0.8 0.9", AnchorMax = "0.99 0.99", OffsetMax = "0 0" },
                    Image = { Color = "0.25 0.50 0.50 0" },
                }, "Overlay", Not);
			container.Add(new CuiElement
            {
                
                Parent = Not,
                
                Components =
                    {
                        new CuiRawImageComponent { Png = (string) ImageLibrary.Call("GetImage", "jh")},
                        new CuiRectTransformComponent{ AnchorMin = "0 0", AnchorMax = "1 1" }, 
                    }
            });
			container.Add(new CuiPanel 
                {
                    
                    RectTransform = { AnchorMin = "0.02 0.74", AnchorMax        = "1 0.98" },
                    Image = { Color = "1.00 0.50 0.50 0" },
                }, Not, Not + "t");
				
			container.Add(new CuiElement 
                {
                
                Parent = Not + "t",
                Components =
                {
                    new CuiTextComponent {Text = title, Align = TextAnchor.UpperLeft, FontSize = 14, Color = "0.72 0.83 0.71 1.00"},
                    new CuiRectTransformComponent { AnchorMin = "0 0", AnchorMax        = "1 1" },
                    new CuiOutlineComponent { Color = "0.90 0.66 0.64 0.5", Distance = "0.1 0.1" }
                }
                });
				
				
				
			container.Add(new CuiPanel
                {
                    
                    RectTransform = { AnchorMin = "0.02 0", AnchorMax        = "1 0.7" },
                    Image = { Color = "1.00 0.50 0.00 0" },
                }, Not, Not + "m");
			container.Add(new CuiElement  
                {
                 
                Parent = Not + "m", 
                Components =
                {
                    new CuiTextComponent {Text = msg, Align = TextAnchor.UpperLeft, FontSize = 12, Color = "0.72 0.83 0.71 1"},
                    new CuiRectTransformComponent { AnchorMin = "0 0", AnchorMax        = "1 0.95" },
                    new CuiOutlineComponent { Color = "0 0 0 0.7", Distance = "1 1" }
                }
                });
				
				
			container.Add(new CuiButton
                {
                    RectTransform = { AnchorMin = "0 0", AnchorMax = "1 1" },
                    Button = { Close = Not, Command = comm, Color = "1.00 0.00 0.00 0" },
                    Text = { Text = "", FontSize = 50, Align = TextAnchor.MiddleCenter }
                },  Not);	
				
			
			container.Add(new CuiButton
                {
                    RectTransform = { AnchorMin = "0.91 0.7", AnchorMax = "1 1" },
                    Button = { Close = Not, Color = "1.00 0.00 0.00 0" },
                    Text = { Text = "", FontSize = 50, Align = TextAnchor.MiddleCenter }
                },  Not);
				
			CuiHelper.AddUi(player, container);
			Effect effect = new Effect("ASSETS/BUNDLED/PREFABS/FX/INVITE_NOTICE.PREFAB", player, 0, new Vector3(), new Vector3());
            EffectNetwork.Send(effect, player.Connection);
		}
		
	}
}

Автор
15FPS
Скачиваний
0
Просмотры
1
Первый выпуск
Обновление
Оценка
0.00 звёзд 0 оценок
Сверху