Это меню для игры. Сама игра работает нормально. Но вот при инжекте меню. Начинает сильно жрать память примерно 2-3Мб в секунду. Вот собственно сам код.
public static void LoadMod()
{
try
{
new GameObject(typeof(Bootstrap).FullName).AddComponent(typeof(Bootstrap));
}
catch (Exception ex)
{
}
}
public void Awake()
{
UnityEngine.Object.DontDestroyOnLoad(base.gameObject);
}
public void Update()
{
if (this.windowID_main == 2)
{
Screen.lockCursor = false;
}
}
public void StyleWindow()
{
var texture = new Texture2D(1, 1, TextureFormat.ARGB32, false);
texture.SetPixel(1, 1, new Color(0.0f, 0.0f, 0.0f, 0.5f));
texture.Apply();
stl_window = new GUIStyle(GUI.skin.window);
stl_window.normal.background = texture;
stl_window.onNormal.background = texture;
stl_window.normal.textColor = Color.green;
stl_window.onNormal.textColor = Color.green;
stl_window.hover.textColor = Color.green;
}
public void StyleButton()
{
this.stl_button = new GUIStyle(GUI.skin.button);
this.stl_button.border.left = 8;
this.stl_button.border.right = 8;
this.stl_button.border.top = 0;
this.stl_button.border.bottom = 0;
}
public void StyleLabel()
{
this.stl_label = new GUIStyle(GUI.skin.label);
this.stl_label.normal.textColor = Color.blue;
this.stl_label.onNormal.textColor = Color.blue;
this.stl_label.hover.textColor = Color.blue;
}
public void StyleTextField() => this.stl_textfield = NewMethod();
private static GUIStyle NewMethod()
{
return new GUIStyle(GUI.skin.textField)
{
alignment = TextAnchor.MiddleCenter,
fontSize = 0b10000
};
}
public void OnGUI()
{
this.StyleWindow();
this.StyleButton();
this.StyleLabel();
this.StyleTextField();
if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Q)
{
if (this.windowID_main == 0)
{
this.windowID_main = 2;
Screen.lockCursor = false;
}
else if (this.windowID_main == 2)
{
this.windowID_main = 0;
Screen.lockCursor = true;
}
Event.current.Use();
}
if (this.windowID_main == 2)
{
this.rectMainmenu = GUI.Window(0, this.rectMainmenu, new GUI.WindowFunction(this.Show_MainMenu), "Главное меню:", this.stl_window);
if (this.windowName == "wSettings")
{
this.rectSecond_x1 = GUI.Window(1, this.rectSecond_x1, new GUI.WindowFunction(this.Show_Settings), "Настройки:", this.stl_window);
}
if (this.windowName == "wStandart")
{
this.rectSecond_x1 = GUI.Window(2, this.rectSecond_x1, new GUI.WindowFunction(this.Method_0), "Разное:", this.stl_window);
}
if (this.windowName == "wVip")
{
this.rectSecond_x2 = GUI.Window(3, this.rectSecond_x2, new GUI.WindowFunction(this.Method_1), "VIP:", this.stl_window);
}
if (this.windowName == "wMoney")
{
this.rectSecond_x3 = GUI.Window(4, this.rectSecond_x3, new GUI.WindowFunction(this.Method_2), "РУБлята:", this.stl_window);
}
if (this.windowName == "wWarp")
{
this.rectSecond_x3 = GUI.Window(5, this.rectSecond_x3, new GUI.WindowFunction(this.Method_3), "Варпы:", this.stl_window);
}
}
}
public void Show_MainMenu(int winID)
{
this.t_B_1 = this.t_B_0;
if (GUI.Button(new Rect((float)this.l_B_0, (float)this.t_B_1, (float)this.wB, (float)this.hB), "Настройки", this.stl_button))
{
this.windowName = "wSettings";
}
this.t_B_1 += this.hPlus;
if (GUI.Button(new Rect((float)this.l_B_0, (float)this.t_B_1, (float)this.wB, (float)this.hB), "Разное", this.stl_button))
{
this.windowName = "wStandart";
}
this.t_B_1 += this.hPlus;
if (GUI.Button(new Rect((float)this.l_B_0, (float)this.t_B_1, (float)this.wB, (float)this.hB), "VIP", this.stl_button))
{
this.windowName = "wVip";
}
this.t_B_1 += this.hPlus;
if (GUI.Button(new Rect((float)this.l_B_0, (float)this.t_B_1, (float)this.wB, (float)this.hB), "РУБлята", this.stl_button))
{
this.windowName = "wMoney";
}
this.t_B_1 += this.hPlus;
if (GUI.Button(new Rect((float)this.l_B_0, (float)this.t_B_1, (float)this.wB, (float)this.hB), "Варпы", this.stl_button))
{
this.windowName = "wWarp";
}
this.t_B_1 += this.hPlus;
this.rectMainmenu = new Rect(10f, 10f, 180f, (float)(this.t_B_1 + 15));
}
public void Show_Settings(int winID)
{
this.t_B_1 = this.t_B_0;
this.Button_Console("Включить траву говно", "grass.on true", false);
this.rectSecond_x1 = new Rect(200f, 10f, 180f, (float)(this.t_B_1 + 15));
}
private void Method_0(int int_0)
{
this.t_B_1 = this.t_B_0;
this.Button_Default("Кто онлайн", "players", true, false);
this.Button_Default("Баланс", "balance", true, false);
this.rectSecond_x1 = new Rect(200f, 10f, 180f, (float)(this.t_B_1 + 15));
}
private void Method_1(int int_0)
{
this.t_B_1 = this.t_B_0;
this.Button_Default("Купить hp200", "vip hp200", true, false);
this.Button_Default("Купить hp250", "vip hp250", true, false);
this.rectSecond_x2 = new Rect(200f, 10f, 355f, (float)(this.t_B_1 + 15));
}
private void Method_2(int int_0)
{
this.t_B_1 = this.t_B_0;
GUI.Label(new Rect((float)this.l_B_1, (float)this.t_B_1, (float)(this.wB / 2), (float)this.hB), "Сумма: ", this.stl_label);
this.string_0 = GUI.TextField(new Rect((float)(this.wB / 2 + 10), (float)this.t_B_1, (float)(this.wB / 2), (float)this.hB), this.string_0, this.stl_textfield);
this.Buttot_Output("Положить в банк Клана", "clan deposit", this.l_B_1 + 180, this.t_B_1, this.wB, this.hB, this.string_0, "");
this.Buttot_Output("Снять с банка Клана", "clan withdraw", this.l_B_1 + 360, this.t_B_1, this.wB, this.hB, this.string_0, "");
this.t_B_1 += this.hPlus;
this.t_B_1 += this.hPlus;
GUI.Label(new Rect((float)this.l_B_1, (float)this.t_B_1, (float)(this.wB / 2), (float)this.hB), "Игрок: ", this.stl_label);
this.string_1 = GUI.TextField(new Rect((float)(this.wB / 2 + 10), (float)this.t_B_1, (float)(this.wB / 2), (float)this.hB), this.string_1, this.stl_textfield);
this.Buttot_Output("Передать игроку", "send", this.l_B_1 + 180, this.t_B_1, this.wB, this.hB, this.string_0, this.string_1);
this.t_B_1 += this.hPlus;
this.rectSecond_x3 = new Rect(200f, 10f, 550f, (float)(this.t_B_1 + 15));
}
private void Method_3(int int_0)
{
int num = 40;
int num2 = 10;
int num3 = 20;
int num4 = 200;
int num5;
for (int i = 1; i <= 10; i = num5 + 1)
{
if (GUI.Button(new Rect((float)num2, (float)num3, (float)num, (float)num), i.ToString()))
{
ConsoleNetworker.singleton.networkView.RPC<string>("SV_RunConsoleCommand", uLink.RPCMode.Server, "chat.say \"/w " + i.ToString() + "\"");
}
num2 += num;
if (num2 > num4)
{
num3 += num;
num2 = 10;
}
num5 = i;
}
this.rectSecond_x3 = new Rect(200f, 10f, 220f, (float)(num3 + num + 15));
}
public void Buttot_Output(string name, string cmd, int mLeft, int mTop, int b_W, int b_H, string text = "", string player = "")
{
string arg = "";
if (text != "" && player == "")
{
arg = string.Format("chat.say \"/{0} {1}\"", cmd, text);
}
if (text != "" && player.Length > 0)
{
arg = string.Format("chat.say \"/{0} {1} {2}\"", cmd, player, text);
}
if (GUI.Button(new Rect((float)mLeft, (float)mTop, (float)b_W, (float)b_H), name, this.stl_button))
{
ConsoleNetworker.singleton.networkView.RPC<string>("SV_RunConsoleCommand", uLink.RPCMode.Server, arg);
}
}
public void Button_Default(string name, string cmd, bool isCommand = false, bool left = false)
{
int num = this.l_B_1;
if (left)
{
num = this.l_B_2;
}
if (GUI.Button(new Rect((float)num, (float)this.t_B_1, (float)this.wB, (float)this.hB), name, this.stl_button))
{
ConsoleNetworker.singleton.networkView.RPC<string>("SV_RunConsoleCommand", uLink.RPCMode.Server, "chat.say \"/" + cmd + "\"");
if (isCommand)
{
this.windowID_main = 0;
Screen.lockCursor = true;
}
}
this.t_B_1 += this.hPlus;
}
public void Button_Console(string name, string cmd, bool isCommand = false)
{
if (GUI.Button(new Rect((float)this.l_B_1, (float)this.t_B_1, (float)this.wB, (float)this.hB), name, this.stl_button))
{
ConsoleSystem.Run(cmd, false);
}
this.t_B_1 += this.hPlus;
}
public Bootstrap()
{
this.windowID_main = 0;
this.windowName = "";
this.wB = 160;
this.hB = 30;
this.hPlus = 30;
this.l_B_0 = 10;
this.l_B_1 = 10;
this.l_B_2 = 185;
this.t_B_0 = 20;
this.t_B_1 = 20;
this.t_B_2 = 20;
this.string_0 = "";
this.string_1 = "";
}
public int windowID_main;
public string windowName;
public int wB;
public int hB;
public int hPlus;
public int l_B_0;
public int l_B_1;
public int l_B_2;
public int t_B_0;
public int t_B_1;
public int t_B_2;
public Rect rectMainmenu;
public Rect rectSecond_x1;
public Rect rectSecond_x2;
public Rect rectSecond_x3;
public Rect rectSecond_x4;
private string string_0;
private string string_1;
public GUIStyle stl_window;
public GUIStyle stl_button;
public GUIStyle stl_label;
public GUIStyle stl_textfield;
}
}
Айфон мало держит заряд, разбираемся с проблемой вместе с AppLab
Перевод документов на английский язык: Важность и ключевые аспекты
Есть TextBox в который вводятся буквы и по этим буквам база выдает мне результат поискаВот код:
Внимание! Это перевод вопроса ASPNET Core 2 - ReSharper “Create Razor View” adds new view to Pages folder
У меня есть 3 проекта в TFS, один это Web Application, второй DLL, третий это Console Application