public LoginController(LoginScope scope, UIManagerService uiManager, ClientSiteManagerService clientSiteManagerService, MessageService messageService, CreateUIService createUIService, ClientManagerService clientManagerService) { myScope = scope; myScope.Visible = true; myUIManager = uiManager; myclientSiteManagerService = clientSiteManagerService; myMessageService = messageService; myCreateUIService = createUIService; this.clientManagerService = clientManagerService; myScope.Model = new LoginScopeModel(); /* scope.Model.dosomething += (o) => { Console.WriteLine(o); }; */ scope.Model.Username = "******"; scope.Model.Password = "******"; myScope.Model.WindowClosed = () => { Window.Alert("woooo"); }; myScope.Model.LoginAccount = LoginAccountFn; myScope.Model.CreateAccount = CreateAccountFn; myclientSiteManagerService.OnLogin += OnLoginFn; myclientSiteManagerService.OnUserCreate += OnUserCreateFn; /* myScope.Model.Username = "******"; myScope.Model.Password = "******"; */ // Window.SetTimeout(LoginAccountFn, 250); }
public ActiveLobbyController(ActiveLobbyScope scope, ClientManagerService clientManagerService,CreateUIService createUIService) { myScope = scope; this.clientManagerService = clientManagerService; myCreateUIService = createUIService; myScope.Model.ChatLines = new List<ChatMessageRoomModel>(); myScope.Visible = false; myScope.Model.WindowClosed += () => { myScope.SwingAway(SwingDirection.BottomRight, false, null); clientManagerService.ClientSiteManagerService.LeaveRoom( new LeaveRoomRequest(myScope.Model.Room)); myCreateUIService.CreateSingleton(HomeController.View); myScope.DestroyWindow(); }; myScope.Model.StartGame += () => { clientManagerService.ClientSiteManagerService.StartGame(new StartGameRequest()); }; clientManagerService.ClientGameManagerService.OnGameStarted += (user, room) => { myCreateUIService.Create(GameController.View); //UIWindow.Height = 200; }; myScope.Model.SendChatMessage += () => { if (myScope.Model.CurrentChatMessage.Trim() == string.Empty) return; clientManagerService.ClientChatManagerService.SendChatMessage( new SendChatMessageModel(myScope.Model.CurrentChatMessage.Trim())); myScope.Model.CurrentChatMessage = ""; }; clientManagerService.ClientSiteManagerService.OnGetRoomInfoReceived += GetRoomInfo; clientManagerService.ClientChatManagerService.OnGetChatLines += GetChatLines; clientManagerService.ClientChatManagerService.OnGetChatInfo += GetChatInfo; myScope.OnReady = () => { myScope.SwingAway(SwingDirection.BottomRight, true, null); PopulateGameRoom(myScope.Model.Room); myScope.SwingBack(null); }; }
public GameCodeController(GameCodeScope scope, ClientManagerService clientManagerService, MessageService messageService) { Instance = this; //scope.Model. myScope = scope; myClientManagerService = clientManagerService; myMessageService = messageService; scope.Visible = true; /* scope.Model.CodeMirrorOptions =new {lineNumbers= true,theme="midnight",mode="javascript" , onGutterClick= (cm, n) =>{ var info = cm.lineInfo(n); if (info.markerText) { window.shuffUIManager.codeArea.breakPoints.splice(window.shuffUIManager.codeArea.breakPoints.indexOf(n-1), 0); cm.clearMarker(n); } else { window.shuffUIManager.codeArea.breakPoints.push(n-1); cm.setMarker(n, "<span style='color: #900'>●</span> %N%");}},extraKeys=new { "Ctrl-Space"= "autocomplete","Ctrl-S"="save" }} ; */ scope.Watch("model.game.gameCode.code", () => { }); myScope.Watch("model.game", () => { myScope.Model.UpdateStatus = UpdateStatusType.Dirty; }, true); scope.Model.ForceUpdate = false; scope.OnReady += () => { scope.Model.ForceUpdate = true; scope.Apply(); }; myClientManagerService.ClientSiteManagerService.OnDeveloperUpdateGameReceived += OnDeveloperUpdateGameReceivedFn; myScope.Model.UpdateStatus = UpdateStatusType.Synced; myScope.Model.UpdateGame = UpdateGameFn; }
public DebugGameCodeController(DebugGameCodeScope scope, ClientManagerService clientManagerService, MessageService messageService) { Instance = this; //scope.Model. this.scope = scope; myClientManagerService = clientManagerService; myMessageService = messageService; scope.Visible = true; scope.Model.Breakpoints = new List<int>(); var extraKeys = new JsDictionary<string, string>(); extraKeys["Ctrl-Space"] = "autocomplete"; extraKeys["Ctrl-S"] = "save"; scope.Model.CodeMirrorOptions = new CodeMirrorOptions() { LineNumbers = true, Theme = "midnight", Mode = "javascript", Gutters = new[] { "CodeMirror-linenumbers", "breakpoints" }, OnGutterClick = (cm, n, gutter, evt) => { scope.Model.CodeMirror = cm; var info = cm.LineInfo(n); if (info.GutterMarkers != null && info.GutterMarkers["breakpoints"] != null) { scope.Model.Breakpoints.Remove(n + 1); cm.SetGutterMarker(n, "breakpoints", null); } else { scope.Model.Breakpoints.Add(n+1); cm.SetGutterMarker(n, "breakpoints", makeMarker()); } if (scope.Model.Room != null) { clientManagerService.ClientDebugManagerService.DebugResponse(new DebugResponse(scope.Model.Room.RoomID, scope.Model.Breakpoints, StepType.Continue, false)); } }, OnLoad = (editor) => { scope.Model.CodeMirror = editor; }, ExtraKeys = extraKeys }; clientManagerService.ClientDebugManagerService.OnGetDebugBreak += (user, debugBreak) => { for (int i = 0; i < scope.Model.CodeMirror.LineCount(); i++) { scope.Model.CodeMirror.RemoveLineClass(i, "background", "codemirror-highlight-line"); } scope.Model.CodeMirror.AddLineClass(debugBreak.LineNumber-1, "background", "codemirror-highlight-line"); scope.Model.CodeMirror.SetCursor(debugBreak.LineNumber-1, 0); scope.Model.VariableLookupResult = debugBreak.VariableLookupResult; scope.Apply(); }; scope.Model.StepInto = () => { clientManagerService.ClientDebugManagerService.DebugResponse(new DebugResponse(scope.Model.Room.RoomID, scope.Model.Breakpoints, StepType.Into, true)); }; scope.Model.StepOver = () => { clientManagerService.ClientDebugManagerService.DebugResponse(new DebugResponse(scope.Model.Room.RoomID, scope.Model.Breakpoints, StepType.Over, true)); }; scope.Model.Continue = () => { clientManagerService.ClientDebugManagerService.DebugResponse(new DebugResponse(scope.Model.Room.RoomID, scope.Model.Breakpoints, StepType.Continue, true)); }; scope.Model.LookupVariable = () => { clientManagerService.ClientDebugManagerService.DebugResponse(new DebugResponse(scope.Model.Room.RoomID, scope.Model.Breakpoints, StepType.Lookup, true) { VariableLookup = scope.Model.VariableLookup }); }; scope.Watch("model.game.gameCode.code", () => { }); this.scope.Watch("model.game", () => { this.scope.Model.UpdateStatus = UpdateStatusType.Dirty; }, true); scope.Model.ForceUpdate = false; scope.OnReady += () => { scope.Model.ForceUpdate = true; scope.Apply(); }; myClientManagerService.ClientSiteManagerService.OnDeveloperUpdateGameReceived += OnDeveloperUpdateGameReceivedFn; this.scope.Model.UpdateStatus = UpdateStatusType.Synced; this.scope.Model.UpdateGame = UpdateGameFn; }