/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { graphics.PreferredBackBufferHeight = 480; graphics.PreferredBackBufferWidth = 640; IsFixedTimeStep = true; graphics.SynchronizeWithVerticalRetrace = true; graphics.PreferMultiSampling = true; graphics.ApplyChanges(); //initialize the various tools we'll use EditorScreen.initialize(form, this); TileTool.InitializeTool(this, form); ModelTool.InitializeTool(this, form); NPCTool.InitializeTool(this, form); base.Initialize(); }
/// <summary> /// sync data /// </summary> /// <returns>sync result</returns> public bool SyncData() { try { List <Mes_ua_submit> listFromScada = GetSubmitSourceDataFromScada(); List <Mes_ua_submit> listFromMes = GetSubmitSourceDataFromMes(); List <Mes_ua_submit> listSame = ModelTool.GetJoin(listFromScada, listFromMes); List <Mes_ua_submit> listAdd = ModelTool.GetMinus(listFromScada, listSame); List <Mes_ua_submit> listDelete = ModelTool.GetMinus(listFromMes, listSame); AddDataIntoMes(listAdd); RemoveDataFromMes(listDelete); return(true); } catch (Exception ex) { LogTool.Error(ex); return(false); } }
static public void draw(World world) { //draw tiles GameDraw.DrawAdjacentGround(world, lookAtPosition); //draw scenery/models GameDraw.DrawScenery(world); //draw npc's //GameDraw.updateNPCSpritesheets(world); GameDraw.DrawNPCs(world); //draw the temporary NPC if we are setting a path if (editor.toolTab.SelectedTab == editor.NPCTab) { NPCTool.Draw(); } else if (editor.toolTab.SelectedTab == editor.SceneryTab) { ModelTool.Draw(currentKeyState); } }
partial void OnValidate(System.Data.Linq.ChangeAction action) { ModelTool.ValidateStringLength(this); }
partial void OnCreated() { ModelTool.SetDefault(this); //this.ID = Guid.NewGuid(); }
partial void OnCreated() { ModelTool.SetDefault(this); }
//[Route("api/{controller}")] public void Put([FromBody] object modelObj) { WebApiBasicBll bll = new WebApiBasicBll(); bll.UpdateByModel(ModelTool.ChangeObjectToList <Me_worker>(modelObj)); }
//[Route("api/{controller}")] public void Delete([FromBody] object pmsObj) { WebApiBasicBll bll = new WebApiBasicBll(); bll.DeleteModelByPms <Me_worker>(ModelTool.ChangeObjectToList <Dictionary <string, object> >(pmsObj)); }
static public void update(GameTime gameTime, World world) { //get current state of keyboard and mouse currentMouseState = Mouse.GetState(); currentKeyState = Keyboard.GetState(); //keyboard actions HandleArrowKeys(); if (currentKeyState.IsKeyDown(Keys.A)) { lookAtPosition -= new Vector3(GameDraw.cameraOffset.Length() / 100, 0, 0); } if (currentKeyState.IsKeyDown(Keys.D)) { lookAtPosition += new Vector3(GameDraw.cameraOffset.Length() / 100, 0, 0); } if (currentKeyState.IsKeyDown(Keys.S)) { lookAtPosition += new Vector3(0, GameDraw.cameraOffset.Length() / 100, 0); } if (currentKeyState.IsKeyDown(Keys.W)) { lookAtPosition -= new Vector3(0, GameDraw.cameraOffset.Length() / 100, 0); } //undo action //check whether a ctrl is down, and the Z key has been pressed (was up, is now down) if ((currentKeyState.IsKeyDown(Keys.LeftControl) || currentKeyState.IsKeyDown(Keys.RightControl)) && (currentKeyState.IsKeyDown(Keys.Z) && prevKeyState.IsKeyUp(Keys.Z))) { //make sure the next history isn't empty if (editor.zoneHistory[editor.historyIndex + 1] != null) { //increase history index by one if possible editor.historyIndex++; if (editor.historyIndex >= editor.historySize) { editor.historyIndex = editor.historySize - 1; } //change to the historical zone game.world.addZone(editor.zoneHistory[editor.historyIndex]); game.world.changeZone(editor.zoneHistory[editor.historyIndex]); GameDraw.MakeAdjBuffers(game.world); } } //redo action //check whether a ctrl is down, and the Y key has been pressed (was up, is now down) if ((currentKeyState.IsKeyDown(Keys.LeftControl) || currentKeyState.IsKeyDown(Keys.RightControl)) && (currentKeyState.IsKeyDown(Keys.Y) && prevKeyState.IsKeyUp(Keys.Y))) { //make sure there is room for us to redo if (editor.historyIndex > 0) { editor.historyIndex--; //if so then restore the next zone state game.world.addZone(editor.zoneHistory[editor.historyIndex]); game.world.changeZone(editor.zoneHistory[editor.historyIndex]); GameDraw.MakeAdjBuffers(game.world); } } //mouse actions { //if mouse is down if (currentMouseState.LeftButton == ButtonState.Pressed) { //check if mouse has been pressed, and if so then save current history //that way you can undo to whatever the state was before the mouse was pressed if (prevMouseState.LeftButton == ButtonState.Released && currentMouseState.LeftButton == ButtonState.Pressed) { updateHistory(); } //if we have an actual tile selected do the different options if (game.selectedX != -1 && game.selectedY != -1) { //if we are in the tile section if (editor.toolTab.SelectedTab == editor.TileSpritesTab) { TileTool.ApplyImage(); } //if we are in the tile settings tab if (editor.toolTab.SelectedTab == editor.TilePropertiesTab) { TileTool.ApplySettings(); } //if we are in the NPC tab if (editor.toolTab.SelectedTab == editor.NPCTab) { if (NPCTool.toolType == NPCToolType.PlaceNPC) { NPCTool.PlaceNPC(); } else if (NPCTool.toolType == NPCToolType.SetWanderArea) { //on start setting the wander area if (prevMouseState.LeftButton == ButtonState.Released) { NPCTool.StartSetWander(); } } else if (NPCTool.toolType == NPCToolType.EditNPC) { //on click pick up the NPC if (prevMouseState.LeftButton == ButtonState.Released) { NPCTool.PickUpNPC(); } //update postion of NPC if we have one active if (editor.activeNPCEdit != null) { //if there are no obstables if (world.currentArea.tile[game.selectedX, game.selectedY].isClear()) { editor.activeNPCEdit.tileCoords = new Point(game.selectedX, game.selectedY); } } } else if (NPCTool.toolType == NPCToolType.DeleteNPC) { NPCTool.DeleteNPC(); } } //if we are in the model tab if (editor.toolTab.SelectedTab == editor.SceneryTab) { //place a new model if new is selected if (editor.modelNewRadio.Checked) { if (editor.sceneryBox.SelectedItem != null) { ModelTool.PlaceModel(); } } //if delete is selected then it should act as a delete tool else if (editor.modelDeleteRadio.Checked) { ModelTool.DeleteModel(); } //edit model if edit is selected else if (editor.modelEditRadio.Checked) { //on "click" rather than whenever pressed if (prevMouseState.LeftButton == ButtonState.Released) { ModelTool.EditModel(); //on mouse down we "pick up" the scenery object ModelTool.PickUpScenery(); } } } } } //on mouse release if (prevMouseState.LeftButton == ButtonState.Pressed && currentMouseState.LeftButton == ButtonState.Released) { //if we have an actual tile selected do the different options if (game.selectedX != -1 && game.selectedY != -1) { //if we are in the model tab if (editor.toolTab.SelectedTab == editor.SceneryTab && editor.modelEditRadio.Checked) { //on mouse up we "drop" the scenery object ModelTool.DropScenery(); } //if we are on the NPC tab if (editor.toolTab.SelectedTab == editor.NPCTab) { if (NPCTool.toolType == NPCToolType.SetWanderArea && editor.NPCEditRadio.Checked) { NPCTool.EndSetWander(); } else if (NPCTool.toolType == NPCToolType.EditNPC && editor.NPCEditRadio.Checked) { if (NPCTool.holdingNPC) { NPCTool.DropNPC(); } } } } } //when we release the mouse we want to save the current state as the most recent history if (prevMouseState.LeftButton == ButtonState.Pressed && currentMouseState.LeftButton == ButtonState.Released) { //if the history index is zero we want to save the current zone if (editor.historyIndex == 0) { editor.zoneHistory[0] = new Zone(game.world.currentArea); } } HandleScrollWheelActions(); } //update previous mouse/keyboard state prevMouseState = currentMouseState; prevKeyState = currentKeyState; }
//[Route("api/{controller}")] public void Post([FromBody] object modelObj) { WebApiBasicBll bll = new WebApiBasicBll(); bll.CreateByModel(ModelTool.ChangeObjectToList <Mes_ua_submit>(modelObj)); }