From d76e12d83e88a6cd83de107da6182a00042e00e8 Mon Sep 17 00:00:00 2001 From: nullptr-w8 Date: Mon, 27 Sep 2021 16:10:13 +0500 Subject: [PATCH 1/2] Add WebRender fix fir --- .../Benchmarks/Packets/GumpUtilities.cs | 5 + Projects/Server/Gumps/Gump.cs | 20 +- Projects/Server/Gumps/GumpBody.cs | 27 ++ Projects/Server/Gumps/GumpBodyUpdate.cs | 34 ++ .../Network/Packets/IncomingPlayerPackets.cs | 11 +- .../Network/Packets/OutgoingGumpPackets.cs | 6 + .../Commands/Object Creation/AddGump.cs | 8 +- Projects/UOContent/Gumps/SciterTestGump.cs | 292 ++++++++++++++++++ 8 files changed, 395 insertions(+), 8 deletions(-) create mode 100644 Projects/Server/Gumps/GumpBody.cs create mode 100644 Projects/Server/Gumps/GumpBodyUpdate.cs create mode 100644 Projects/UOContent/Gumps/SciterTestGump.cs diff --git a/Projects/Benchmarks/Benchmarks/Packets/GumpUtilities.cs b/Projects/Benchmarks/Benchmarks/Packets/GumpUtilities.cs index 5df0a12fe..c14ae27a2 100644 --- a/Projects/Benchmarks/Benchmarks/Packets/GumpUtilities.cs +++ b/Projects/Benchmarks/Benchmarks/Packets/GumpUtilities.cs @@ -14,6 +14,11 @@ namespace Server.Tests.Network IGumpWriter disp = new DisplayGumpFast(g); // IGumpWriter disp = new DisplayGumpPacked(g); + if (g.UseWebRender) + { + disp.AppendLayout(Gump.WebRender); + } + if (!g.Draggable) { disp.AppendLayout(Gump.NoMove); diff --git a/Projects/Server/Gumps/Gump.cs b/Projects/Server/Gumps/Gump.cs index cc0940914..29129be0c 100644 --- a/Projects/Server/Gumps/Gump.cs +++ b/Projects/Server/Gumps/Gump.cs @@ -1,5 +1,7 @@ using System; using System.Collections.Generic; +using System.Text; +using System.Text.Json; using Server.Network; using Server.Text; @@ -8,7 +10,7 @@ namespace Server.Gumps public class Gump { private static Serial _nextSerial = (Serial)1; - + public static readonly byte[] WebRender = StringToBuffer("{ webrender }"); public static readonly byte[] NoMove = StringToBuffer("{ nomove }"); public static readonly byte[] NoClose = StringToBuffer("{ noclose }"); public static readonly byte[] NoDispose = StringToBuffer("{ nodispose }"); @@ -52,6 +54,8 @@ namespace Server.Gumps public bool Closable { get; set; } = true; + public bool UseWebRender { get; set; } = false; + public static int GetTypeID(Type type) => type?.FullName?.GetHashCode(StringComparison.Ordinal) ?? -1; public void AddPage(int page) @@ -68,7 +72,21 @@ namespace Server.Gumps { Add(new GumpBackground(x, y, width, height, gumpID)); } + public void SendData(Mobile m, string responseMethod, object value) + { + Entries.Clear(); + var jtext = JsonSerializer.Serialize(value, new JsonSerializerOptions() { WriteIndented = true }); + Add(new GumpBodyUpdate(responseMethod, + Convert.ToBase64String(Encoding.UTF8.GetBytes(jtext)))); + + m.SendGump(this); + } + + public void AddBody(string body) + { + Add(new GumpBody(Convert.ToBase64String(Encoding.UTF8.GetBytes(body)))); + } public void AddButton( int x, int y, int normalID, int pressedID, int buttonID, GumpButtonType type = GumpButtonType.Reply, int param = 0 diff --git a/Projects/Server/Gumps/GumpBody.cs b/Projects/Server/Gumps/GumpBody.cs new file mode 100644 index 000000000..6e8340946 --- /dev/null +++ b/Projects/Server/Gumps/GumpBody.cs @@ -0,0 +1,27 @@ +using Server.Collections; +using System; +using System.Buffers; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Server.Gumps +{ + public class GumpBody : GumpEntry + { + public static readonly byte[] LayoutName = Gump.StringToBuffer("body"); + + public override string Compile(OrderedHashSet strings) => $"{{ body {_body} }}"; + public GumpBody(string body) =>_body = body; + public string _body { get; set; } + public override void AppendTo(ref SpanWriter writer, OrderedHashSet strings, ref int entries, ref int switches) + { + writer.Write((ushort)0x7B20); // "{ " + writer.Write(LayoutName); + writer.WriteAscii(' '); + writer.WriteAscii(_body.ToString()); + writer.Write((ushort)0x207D); // " }" + } + } +} diff --git a/Projects/Server/Gumps/GumpBodyUpdate.cs b/Projects/Server/Gumps/GumpBodyUpdate.cs new file mode 100644 index 000000000..6a46e7cc0 --- /dev/null +++ b/Projects/Server/Gumps/GumpBodyUpdate.cs @@ -0,0 +1,34 @@ +using Server.Collections; +using System; +using System.Buffers; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Server.Gumps +{ + public class GumpBodyUpdate : GumpEntry + { + public static readonly byte[] LayoutName = Gump.StringToBuffer("bodyUpdate"); + + public override string Compile(OrderedHashSet strings) => $"{{ bodyUpdate {_responseButtonId} {_body} }}"; + public GumpBodyUpdate(string responseButtonId, string body) + { + _body = body; + _responseButtonId = responseButtonId; + } + public string _body { get; set; } + public string _responseButtonId { get; set; } + public override void AppendTo(ref SpanWriter writer, OrderedHashSet strings, ref int entries, ref int switches) + { + writer.Write((ushort)0x7B20); // "{ " + writer.Write(LayoutName); + writer.WriteAscii(' '); + writer.WriteAscii(_responseButtonId); + writer.WriteAscii(' '); + writer.WriteAscii(_body); + writer.Write((ushort)0x207D); // " }" + } + } +} diff --git a/Projects/Server/Network/Packets/IncomingPlayerPackets.cs b/Projects/Server/Network/Packets/IncomingPlayerPackets.cs index 00371638d..9fe375898 100644 --- a/Projects/Server/Network/Packets/IncomingPlayerPackets.cs +++ b/Projects/Server/Network/Packets/IncomingPlayerPackets.cs @@ -349,7 +349,7 @@ namespace Server.Network { continue; } - + var isWebResponse = gump.UseWebRender; var buttonExists = buttonID == 0; // 0 is always 'close' if (!buttonExists) @@ -370,7 +370,7 @@ namespace Server.Network } } - if (!buttonExists) + if (!isWebResponse && !buttonExists) { state.LogInfo("Invalid gump response, disconnecting..."); var exception = new InvalidGumpResponseException($"Button {buttonID} doesn't exist"); @@ -384,7 +384,7 @@ namespace Server.Network var switchCount = reader.ReadInt32(); - if (switchCount < 0 || switchCount > gump.m_Switches) + if (!isWebResponse && (switchCount < 0 || switchCount > gump.m_Switches)) { state.LogInfo("Invalid gump response, disconnecting..."); var exception = new InvalidGumpResponseException($"Bad switch count {switchCount}"); @@ -405,7 +405,7 @@ namespace Server.Network var textCount = reader.ReadInt32(); - if (textCount < 0 || textCount > gump.m_TextEntries) + if (!isWebResponse && (textCount < 0 || textCount > gump.m_TextEntries)) { state.LogInfo("Invalid gump response, disconnecting..."); var exception = new InvalidGumpResponseException($"Bad text entry count {textCount}"); @@ -440,7 +440,8 @@ namespace Server.Network textEntries[i] = new TextRelay(entryID, text); } - state.RemoveGump(gump); + if (!isWebResponse) + state.RemoveGump(gump); var prof = GumpProfile.Acquire(gump.GetType()); diff --git a/Projects/Server/Network/Packets/OutgoingGumpPackets.cs b/Projects/Server/Network/Packets/OutgoingGumpPackets.cs index 8fab20ff2..a314b42cf 100644 --- a/Projects/Server/Network/Packets/OutgoingGumpPackets.cs +++ b/Projects/Server/Network/Packets/OutgoingGumpPackets.cs @@ -108,6 +108,12 @@ namespace Server.Network var layoutWriter = new SpanWriter(_layoutBuffer); + + if (gump.UseWebRender) + { + layoutWriter.Write(Gump.WebRender); + } + if (!gump.Draggable) { layoutWriter.Write(Gump.NoMove); diff --git a/Projects/UOContent/Commands/Object Creation/AddGump.cs b/Projects/UOContent/Commands/Object Creation/AddGump.cs index 84e3523a4..1260d4c30 100644 --- a/Projects/UOContent/Commands/Object Creation/AddGump.cs +++ b/Projects/UOContent/Commands/Object Creation/AddGump.cs @@ -86,10 +86,14 @@ namespace Server.Gumps (m_Page + 1) * 10 < searchResults.Length ? 0x7FFF : 0x5EF7 ); } - - public static void Initialize() + private static void Sciter_OnCommand(CommandEventArgs e) + { + e.Mobile.SendGump(new SciterTestGump(e.Mobile)); + } + public static void Initialize() { CommandSystem.Register("AddMenu", AccessLevel.GameMaster, AddMenu_OnCommand); + CommandSystem.Register("t", AccessLevel.GameMaster, Sciter_OnCommand); } [Usage("AddMenu [searchString]"), Description( diff --git a/Projects/UOContent/Gumps/SciterTestGump.cs b/Projects/UOContent/Gumps/SciterTestGump.cs new file mode 100644 index 000000000..ce6b87a43 --- /dev/null +++ b/Projects/UOContent/Gumps/SciterTestGump.cs @@ -0,0 +1,292 @@ +using Server.Gumps; +using Server.Network; +using System; +using System.IO; +using System.Text; + +namespace Server.Gumps +{ + public class SciterTestGump : Gump + { + public class Shop + { + public string[] ShopItems { get; set; } = new string[] { "item1", "item2" }; + } + + public SciterTestGump(Mobile user) : base( + 0, + 0 + ) + { + UseWebRender = true; + AddBody(Body()); + } + + public override void OnResponse(NetState sender, RelayInfo info) + { + var from = sender.Mobile; + switch (info.ButtonID) + { + case 0: // close + sender.RemoveGump(this); + break; + case 1: // hide + from.Hidden = true; + break; + case 2: // unhide + from.Hidden = false; + break; + case 3: // sendDataToCLeint + SendData(from, "ShowSend", new Shop()); + break; + case 4: // showData + var builder = new StringBuilder(); + for (int i = 0; i < info.TextEntries.Length; i++) + { + var test = info.TextEntries[i].Text; + builder.Append("argument "); + builder.Append(i.ToString()); + builder.Append(" = "); + builder.Append(test); + builder.Append(" "); + } + + from.SendAsciiMessage(builder.ToString()); + + break; + default: + break; + + + } + } + public string Body() + { + return "\r\n" + + " \r\n" + + " Test<" + + "/title>\r\n" + + " <style>\r\n" + + " [onmousele" + + "ave] { aspect: \"Emu" + + ".onmouseleave\"; }\r" + + "\n" + + " html {\r" + + "\n" + + " over" + + "flow: hidden;\r\n" + + " \r\n" + + " }\r\n" + + " \r\n" + + " .btn {\r\n" + + " border: 2px solid " + + "black;\r\n" + + " border-radius: 5px" + + ";\r\n" + + " background-color: " + + "white;\r\n" + + " color: black;\r\n" + + " padding: 14px 28px" + + ";\r\n" + + " font-size: 16px;\r" + + "\n" + + " cursor: pointer;\r" + + "\n" + + "} \r\n" + + ".success {\r\n" + + " border-color: #04A" + + "A6D;\r\n" + + " color: green;\r\n" + + "}\r\n\r\n" + + ".success:hover {\r\n" + + " background-color: " + + "#04AA6D;\r\n" + + " color: white;\r\n" + + "}\r\n\r\n" + + "/* Blue */\r\n" + + ".info {\r\n" + + " border-color: #219" + + "6F3;\r\n" + + " color: dodgerblue" + + "\r\n" + + "}\r\n\r\n" + + ".info:hover {\r\n" + + " background: #2196F" + + "3;\r\n" + + " color: white;\r\n" + + "}\r\n\r\n" + + "/* Orange */\r\n" + + ".warning {\r\n" + + " border-color: #ff9" + + "800;\r\n" + + " color: orange;\r\n" + + "}\r\n\r\n" + + ".warning:hover {\r\n" + + " background: #ff980" + + "0;\r\n" + + " color: white;\r\n" + + "}\r\n\r\n" + + "/* Red */\r\n" + + ".danger {\r\n" + + " border-color: #f44" + + "336;\r\n" + + " color: red\r\n" + + "}\r\n\r\n" + + ".danger:hover {\r\n" + + " background: #f4433" + + "6;\r\n" + + " color: white;\r\n" + + "}\r\n\r\n" + + "/* Gray */\r\n" + + ".default {\r\n" + + " border-color: #e7e" + + "7e7;\r\n" + + " color: black;\r\n" + + "}\r\n\r\n" + + ".default:hover {\r\n" + + " background: #e7e7e" + + "7;\r\n" + + "}\r\n\r\n" + + " </style>\r\n" + + " <script type=\"t" + + "ext/tiscript\">\r\n" + + "\r\n" + + " namespace Em" + + "u {\r\n" + + " function o" + + "nmouseleave() {\r\n" + + " this.o" + + "n(\"mouseleave\", fu" + + "nction(evt) {\r\n" + + " \r\n" + + " });\r" + + "\n" + + " }\r\n" + + " }\r\n\r\n" + + " function sel" + + "f.ready() {\r\n" + + " view.move(" + + "400px,100px,500,300)" + + ";\r\n" + + " view.windo" + + "wTopmost = false;\r" + + "\n" + + " //focus on" + + " form \r\n" + + " //this.tim" + + "er(20ms, function() " + + "{ view.focusable(#fi" + + "rst).state.focus = t" + + "rue; });\r\n" + + " }\r\n\r\n" + + " self.on(\"ke" + + "ydown\", function(ev" + + "t) {\r\n" + + " if(evt.ke" + + "yCode == 27)\r\n" + + " {\r\n" + + " close(" + + ");\r\n" + + " }\r\n" + + " });\r\n\r\n" + + " function Sho" + + "wSend(data)\r\n" + + " {\r\n" + + " var input " + + "= $(#test);\r\n" + + " if(element" + + ")return; \r\n" + + " input.clea" + + "r();\r\n\r\n" + + " for (var i" + + " = 0; i < data.ShopI" + + "tems.length; i++) {" + + "\r\n" + + " input.ap" + + "pend(data.ShopItems[" + + "i]+\' ,\');\r\n" + + " }\r\n" + + " }\r\n\r\n" + + " function clo" + + "se()\r\n" + + " {\r\n" + + " view.Host_" + + "SEND(0);\r\n" + + " view.windo" + + "wState = View.WINDOW" + + "_HIDDEN;\r\n" + + " view.move(" + + "0px,0px,0,0);\r\n" + + " }\r\n" + + " \r\n\r\n\r\n" + + " event click " + + "$(button#load) {\r\n" + + " view.Hos" + + "t_SEND(3);\r\n" + + " }\r\n\r\n" + + " event click " + + "$(button#send) {\r\n" + + " view.Hos" + + "t_SEND(4,\"arg0\",\"" + + "arg1\",\"arg2\",\"ar" + + "g3\",\"arg4\",\"arg5" + + "\",\"arg6\",\"arg7\"" + + ",\"arg8\",\"arg9\");" + + "\r\n" + + " }\r\n\r\n" + + " event click " + + "$(button#hide) {\r\n" + + " view.Hos" + + "t_SEND(1,\"HELLO WOR" + + "LD YEAH\");\r\n" + + " }\r\n\r\n" + + " event click " + + "$(button#unhide) {\r" + + "\n" + + " view.Hos" + + "t_SEND(2);\r\n" + + " }\r\n\r\n" + + " event click " + + "$(button#close) {\r" + + "\n" + + " close();\r" + + "\n" + + " }\r\n" + + " \r\n\r\n" + + " </script>\r\n" + + " \r\n" + + " </head>\r\n" + + " <body onmouselea" + + "ve>\r\n" + + " <button#load" + + " class=\"btn warning" + + "\" onmouseenter onmo" + + "useleave>getDataFrom" + + "Server</button>\r\n" + + " <button#send" + + " class=\"btn warning" + + "\" onmouseenter onmo" + + "useleave>sendDataToS" + + "erver</button>\r\n" + + " <button#hide" + + " class=\"btn warning" + + "\" onmouseenter onmo" + + "useleave>hide</butto" + + "n>\r\n" + + " <button#unhi" + + "de class=\"btn info" + + "\">unhide</button>\r" + + "\n" + + " <button#clos" + + "e class=\"btn danger" + + "\">Close</button>\r" + + "\n" + + " <textarea id" + + "=\"test\" name=\"com" + + "ment\"></textarea></" + + "p>\r\n" + + " </body>\r\n" + + "</html>"; + } + } +} From af7ce57d89405df0de98cbcf89929c1b58269d76 Mon Sep 17 00:00:00 2001 From: nullptr-w8 <settt555@gmail.com> Date: Thu, 30 Sep 2021 16:15:44 +0500 Subject: [PATCH 2/2] demo sciter-js --- Projects/UOContent/Gumps/SciterTestGump.cs | 477 ++++++++++----------- 1 file changed, 236 insertions(+), 241 deletions(-) diff --git a/Projects/UOContent/Gumps/SciterTestGump.cs b/Projects/UOContent/Gumps/SciterTestGump.cs index ce6b87a43..4147c24c8 100644 --- a/Projects/UOContent/Gumps/SciterTestGump.cs +++ b/Projects/UOContent/Gumps/SciterTestGump.cs @@ -1,4 +1,5 @@ using Server.Gumps; +using Server.Items; using Server.Network; using System; using System.IO; @@ -8,20 +9,48 @@ namespace Server.Gumps { public class SciterTestGump : Gump { + public class Item + { + public string Name { get; set; } + public int Count { get; set; } + } public class Shop { - public string[] ShopItems { get; set; } = new string[] { "item1", "item2" }; + public Item[] ShopItems { get; set; } = new Item[] + { + new Item(){Name="Arrow",Count = 10 }, + new Item(){Name="Bolt",Count = 10 }, + new Item(){Name="Gold",Count = 20000 }, + }; } - + public Shop _shop = new Shop(); public SciterTestGump(Mobile user) : base( 0, 0 ) { UseWebRender = true; - AddBody(Body()); + AddBody(body()); } + + public void TryToAddItem(Mobile m, int index) + { + if (_shop.ShopItems.Length < index) + return; + + var itemName = _shop.ShopItems[index].Name; + var itemCount = Convert.ToInt32(_shop.ShopItems[index].Count); + + var type = AssemblyHandler.FindTypeByName(itemName); + + var item = Activator.CreateInstance(type, args: new object[] { itemCount }); + if (item is Server.Item _item) + { + m.AddToBackpack(_item); + } + + } public override void OnResponse(NetState sender, RelayInfo info) { var from = sender.Mobile; @@ -30,263 +59,229 @@ namespace Server.Gumps case 0: // close sender.RemoveGump(this); break; - case 1: // hide - from.Hidden = true; + case 1: + SendData(from, "1", _shop); break; - case 2: // unhide - from.Hidden = false; + case 2: + TryToAddItem(from, Convert.ToInt32(info.TextEntries[0].Text)); break; - case 3: // sendDataToCLeint - SendData(from, "ShowSend", new Shop()); - break; - case 4: // showData - var builder = new StringBuilder(); - for (int i = 0; i < info.TextEntries.Length; i++) - { - var test = info.TextEntries[i].Text; - builder.Append("argument "); - builder.Append(i.ToString()); - builder.Append(" = "); - builder.Append(test); - builder.Append(" "); - } - from.SendAsciiMessage(builder.ToString()); - - break; default: break; - - } + } - public string Body() + public string body() { - return "<html>\r\n" + - " <head>\r\n" + - " <title>Test<" + - "/title>\r\n" + - " <style>\r\n" + - " [onmousele" + - "ave] { aspect: \"Emu" + - ".onmouseleave\"; }\r" + - "\n" + - " html {\r" + - "\n" + - " over" + - "flow: hidden;\r\n" + - " \r\n" + - " }\r\n" + + return "<html >\r\n" + " \r\n" + - " .btn {\r\n" + - " border: 2px solid " + - "black;\r\n" + - " border-radius: 5px" + + " <style>\r\n" + + " html{backgroun" + + "d-color:black}\r\n" + + " h1 { color: wh" + + "ite;}\r\n" + + " p{color: white" + + ";}\r\n" + + " .btn1 {\r\n" + + " backgrou" + + "nd-color: yellow;\r" + + "\n" + + " color: b" + + "lack;\r\n" + + " text-ali" + + "gn: center;\r\n" + + " font-siz" + + "e: 13px;\r\n" + + " }\r\n" + + " #close {\r\n" + + " position: re" + + "lative;\r\n" + + " float: right" + ";\r\n" + - " background-color: " + - "white;\r\n" + - " color: black;\r\n" + - " padding: 14px 28px" + - ";\r\n" + - " font-size: 16px;\r" + + " \r\n" + + " }\r\n" + + " \r\n" + + " .center {\r\n" + + " position: re" + + "lative;\r\n" + + " float: cente" + + "r;\r\n" + + " } \r\n" + + " \r\n" + + " .close-btn {\r" + "\n" + - " cursor: pointer;\r" + - "\n" + - "} \r\n" + - ".success {\r\n" + - " border-color: #04A" + - "A6D;\r\n" + - " color: green;\r\n" + - "}\r\n\r\n" + - ".success:hover {\r\n" + - " background-color: " + - "#04AA6D;\r\n" + - " color: white;\r\n" + - "}\r\n\r\n" + - "/* Blue */\r\n" + - ".info {\r\n" + - " border-color: #219" + - "6F3;\r\n" + - " color: dodgerblue" + + " font-size: 6" + + "0px;\r\n" + + " font-weight:" + + " bold;\r\n" + + " color: #000;" + "\r\n" + - "}\r\n\r\n" + - ".info:hover {\r\n" + - " background: #2196F" + - "3;\r\n" + - " color: white;\r\n" + - "}\r\n\r\n" + - "/* Orange */\r\n" + - ".warning {\r\n" + - " border-color: #ff9" + - "800;\r\n" + - " color: orange;\r\n" + - "}\r\n\r\n" + - ".warning:hover {\r\n" + - " background: #ff980" + - "0;\r\n" + - " color: white;\r\n" + - "}\r\n\r\n" + - "/* Red */\r\n" + - ".danger {\r\n" + - " border-color: #f44" + - "336;\r\n" + - " color: red\r\n" + - "}\r\n\r\n" + - ".danger:hover {\r\n" + - " background: #f4433" + - "6;\r\n" + - " color: white;\r\n" + - "}\r\n\r\n" + - "/* Gray */\r\n" + - ".default {\r\n" + - " border-color: #e7e" + - "7e7;\r\n" + - " color: black;\r\n" + - "}\r\n\r\n" + - ".default:hover {\r\n" + - " background: #e7e7e" + - "7;\r\n" + - "}\r\n\r\n" + - " </style>\r\n" + - " <script type=\"t" + - "ext/tiscript\">\r\n" + - "\r\n" + - " namespace Em" + - "u {\r\n" + - " function o" + - "nmouseleave() {\r\n" + - " this.o" + - "n(\"mouseleave\", fu" + - "nction(evt) {\r\n" + - " \r\n" + - " });\r" + - "\n" + - " }\r\n" + - " }\r\n\r\n" + - " function sel" + - "f.ready() {\r\n" + - " view.move(" + - "400px,100px,500,300)" + - ";\r\n" + - " view.windo" + - "wTopmost = false;\r" + - "\n" + - " //focus on" + - " form \r\n" + - " //this.tim" + - "er(20ms, function() " + - "{ view.focusable(#fi" + - "rst).state.focus = t" + - "rue; });\r\n" + - " }\r\n\r\n" + - " self.on(\"ke" + - "ydown\", function(ev" + - "t) {\r\n" + - " if(evt.ke" + - "yCode == 27)\r\n" + - " {\r\n" + - " close(" + - ");\r\n" + - " }\r\n" + - " });\r\n\r\n" + - " function Sho" + - "wSend(data)\r\n" + - " {\r\n" + - " var input " + - "= $(#test);\r\n" + - " if(element" + - ")return; \r\n" + - " input.clea" + - "r();\r\n\r\n" + - " for (var i" + - " = 0; i < data.ShopI" + - "tems.length; i++) {" + - "\r\n" + - " input.ap" + - "pend(data.ShopItems[" + - "i]+\' ,\');\r\n" + - " }\r\n" + - " }\r\n\r\n" + - " function clo" + - "se()\r\n" + - " {\r\n" + - " view.Host_" + - "SEND(0);\r\n" + - " view.windo" + - "wState = View.WINDOW" + - "_HIDDEN;\r\n" + - " view.move(" + - "0px,0px,0,0);\r\n" + + " }\r\n" + + " .tsize\r\n" + + " {\r\n" + + " color: r" + + "ed;\r\n" + + " font-siz" + + "e: 18px;\r\n" + + " }\r\n" + + " .myButton " + + "{\r\n" + + " box-shadow" + + ":inset 0px 34px 0px " + + "-15px #b54b3a;\r\n" + + " background" + + ":linear-gradient(to " + + "bottom, #a73f2d 5%, " + + "#b34332 100%);\r\n" + + " background" + + "-color:#a73f2d;\r\n" + + " border:1px" + + " solid #241d13;\r\n" + + " display:in" + + "line-block;\r\n" + + " cursor:poi" + + "nter;\r\n" + + " color:#fff" + + "fff;\r\n" + + " font-famil" + + "y:Arial;\r\n" + + " font-size:" + + "15px;\r\n" + + " font-weigh" + + "t:bold;\r\n" + + " padding:9p" + + "x 23px;\r\n" + + " text-decor" + + "ation:none;\r\n" + + " text-shado" + + "w:0px -1px 0px #7a2a" + + "1d;\r\n" + " }\r\n" + - " \r\n\r\n\r\n" + - " event click " + - "$(button#load) {\r\n" + - " view.Hos" + - "t_SEND(3);\r\n" + - " }\r\n\r\n" + - " event click " + - "$(button#send) {\r\n" + - " view.Hos" + - "t_SEND(4,\"arg0\",\"" + - "arg1\",\"arg2\",\"ar" + - "g3\",\"arg4\",\"arg5" + - "\",\"arg6\",\"arg7\"" + - ",\"arg8\",\"arg9\");" + - "\r\n" + - " }\r\n\r\n" + - " event click " + - "$(button#hide) {\r\n" + - " view.Hos" + - "t_SEND(1,\"HELLO WOR" + - "LD YEAH\");\r\n" + - " }\r\n\r\n" + - " event click " + - "$(button#unhide) {\r" + - "\n" + - " view.Hos" + - "t_SEND(2);\r\n" + - " }\r\n\r\n" + - " event click " + - "$(button#close) {\r" + - "\n" + - " close();\r" + + " .myButton:ho" + + "ver {\r\n" + + " background" + + ":linear-gradient(to " + + "bottom, #b34332 5%, " + + "#a73f2d 100%);\r\n" + + " background" + + "-color:#b34332;\r\n" + + " }\r\n" + + " .myButton:ac" + + "tive {\r\n" + + " position:r" + + "elative;\r\n" + + " top:1px;\r" + "\n" + " }\r\n" + - " \r\n\r\n" + - " </script>\r\n" + + " </style>\r\n" + + " \r\n\r\n" + + "\t<script type=\"mod" + + "ule\">\r\n\r\n" + + "\t\tdocument.ready =" + + " function () {\r\n" + + "\t\t}\r\n" + " \r\n" + - " </head>\r\n" + - " <body onmouselea" + - "ve>\r\n" + - " <button#load" + - " class=\"btn warning" + - "\" onmouseenter onmo" + - "useleave>getDataFrom" + - "Server</button>\r\n" + - " <button#send" + - " class=\"btn warning" + - "\" onmouseenter onmo" + - "useleave>sendDataToS" + - "erver</button>\r\n" + - " <button#hide" + - " class=\"btn warning" + - "\" onmouseenter onmo" + - "useleave>hide</butto" + - "n>\r\n" + - " <button#unhi" + - "de class=\"btn info" + - "\">unhide</button>\r" + + " document.onmouse" + + "leave = function(){" + + "\r\n" + + " Window.this.xc" + + "all(\"GameFocus\");" + + "\r\n" + + " }\r\n" + + "\t</script>\r\n" + + " \r\n" + + "</head>\r\n" + + " <body>\r\n" + + " <div id=\"app\" " + + ">\r\n" + + " <a id=\"clos" + + "e\" v-on:click=\"Clo" + + "se()\" class=\"tsize" + + "\">✕</a>\r\n" + + " <h1 class=\"" + + "center\"> MUO + VueJ" + + "s Demo</h1>\r\n" + + " <ul>\r\n" + + " <li v-for=\"" + + "(item, index) in sho" + + "pItems\">\r\n" + + " <p>{{ item" + + ".Name }} amount: {{ " + + "item.Count }} \r\n" + + " <a href=" + + "\"#\" class=\"myButt" + + "on\" v-on:click=\"Ge" + + "t(index)\">OK</a>\r" + "\n" + - " <button#clos" + - "e class=\"btn danger" + - "\">Close</button>\r" + + " </p>\r\n" + + " </li>\r\n" + + " </ul>\r\n" + + " </div>\r\n" + + " <script src=\"http" + + "s://unpkg.com/vue\">" + + "</script>\r\n" + + " <!-- <script src=" + + "\"js\\vue.js\"></scr" + + "ipt> -->\r\n" + + " <script>\r\n" + + " var app = new " + + "Vue({\r\n" + + " el: \'#app" + + "\',\r\n" + + " data: {\r" + "\n" + - " <textarea id" + - "=\"test\" name=\"com" + - "ment\"></textarea></" + - "p>\r\n" + - " </body>\r\n" + + " shopI" + + "tems: []\r\n" + + " },\r\n" + + " beforeMoun" + + "t(){\r\n" + + " //set s" + + "ize \r\n" + + " Window." + + "this.move(100,100, 5" + + "00, 500, false);\r\n" + + " this.ge" + + "tItems();\r\n" + + " },\r\n" + + " methods: {" + + "\r\n" + + " getItems" + + ": function () {\r\n" + + " Window" + + ".this.xcall(\"SEND\"" + + ", 1 ,function (value" + + ") {\r\n" + + " //" + + "you can\'t use this " + + "now it\'s func\r\n" + + " ap" + + "p.shopItems = value." + + "ShopItems;\r\n" + + "\t\t\t });\r" + + "\n" + + " },\r\n" + + " Get: fun" + + "ction (index) {\r\n" + + " Window" + + ".this.xcall(\"SEND\"" + + ", 2, index);\r\n" + + " },\r\n" + + " Close: f" + + "unction () {\r\n" + + " docu" + + "ment.body.innerHTML " + + "= \"\";\r\n" + + " Wind" + + "ow.this.state = Win" + + "dow.WINDOW_HIDDEN;\r" + + "\n" + + " },\r\n" + + " }\r\n" + + " });\r\n" + + " </script>\r\n" + + " </body>\r\n" + "</html>"; } + } }