// Use this for initialization public virtual void Initialize(MacroAIParty party, Faction faction) { RunningNodeHist = new MaxStack <string>(20); AimSkill = UnityEngine.Random.Range(0.6f, 1f); MyShip = transform.GetComponent <ShipBase>(); AvoidanceDetector = MyShip.MyReference.AvoidanceDetector; AvoidanceDetector.ParentShip = MyShip; Whiteboard = new Whiteboard(); Whiteboard.Initialize(); //AttackTarget = GameManager.Inst.PlayerControl.PlayerShip; //Whiteboard.Parameters["TargetEnemy"] = AttackTarget; Whiteboard.Parameters["SpeedLimit"] = -1f; MyParty = party; MyFaction = faction; MyPartyNumber = MyParty.PartyNumber; WeaponControl = new AIWeaponControl(); WeaponControl.Initialize(this); TreeSet = new Dictionary <string, BehaviorTree>(); TreeSet.Add("BaseBehavior", GameManager.Inst.DBManager.XMLParserBT.LoadBehaviorTree("BaseBehavior", this, party)); TreeSet.Add("Travel", GameManager.Inst.DBManager.XMLParserBT.LoadBehaviorTree("Travel", this, party)); TreeSet.Add("FollowFriendly", GameManager.Inst.DBManager.XMLParserBT.LoadBehaviorTree("FollowFriendly", this, party)); TreeSet.Add("FighterCombat", GameManager.Inst.DBManager.XMLParserBT.LoadBehaviorTree("FighterCombat", this, party)); TreeSet.Add("BigShipCombat", GameManager.Inst.DBManager.XMLParserBT.LoadBehaviorTree("BigShipCombat", this, party)); }
// Use this for initialization void Start() { // Get our Whiteboard component from the whiteboard object this.whiteboard = GameObject.Find("Whiteboard").GetComponent <Whiteboard>(); whiteboard.SetColor(Color.blue); this.InteractableObjectGrabbed += new InteractableObjectEventHandler(GrabObject); }
// Update is called once per frame void Update() { Vector3 tipPos = _tip.transform.position; if (Physics.Raycast(tipPos, transform.up, out touch, drawThresHold)) { if (touch.collider.tag == "Whiteboard") { // Debug.Log("Poop"); this._whiteboard = touch.collider.gameObject.GetComponent <Whiteboard>(); _whiteboard.SetColour(penColor); _whiteboard.SetTouchPosition(touch.textureCoord.x, touch.textureCoord.y); _whiteboard.ToggleTouch(true); if (!lastTouch) { lastTouch = true; lastAngle = this.transform.rotation; } } else { _whiteboard.ToggleTouch(false); lastTouch = false; } } if (lastTouch) { transform.rotation = lastAngle; } }
public bool Create(CreateTeamDTO teamDTO) { var team = _context.Teams.FirstOrDefault(t => t.Name.Equals(teamDTO.Name)); if (team != null) { return(false); } var whiteboard = new Whiteboard { Posts = new List <Post>() }; team = new Team { Name = teamDTO.Name, Members = new List <User>(), Whiteboard = whiteboard }; _context.Teams.Add(team); if (_context.SaveChanges() == 0) { return(false); } return(true); }
public async Task <IActionResult> CreateNew(int user, [FromBody] WhiteboardDtoIn boardDto) { var owner = await _userService.GetById(user); if (owner == null) { return(BadRequest("Could not find User associated to the Owner field")); } var board = new Whiteboard() { Id = boardDto.Id, Title = boardDto.Title, User = owner }; try { await _boardService.Create(board); return(CreatedAtAction(nameof(GetById), new { id = boardDto.Id }, boardDto)); } catch (WhiteboardException ex) { return(BadRequest(new { message = ex.Message })); } }
protected override void Execute() { base.Execute(); logger.Trace("Execute() ..."); Whiteboard.SaveLayout(); logger.Trace("Execute() ..."); }
void Update() { float tipHeight = transform.Find("Tip").transform.localScale.y; Vector3 tip = transform.Find("Tip/TouchPoint").transform.position; whiteboard.SetPenSize(100); //Debug.Log(tip); if (lastTouch) { tipHeight *= 1.1f; } if (Physics.Raycast(tip, transform.up, out touch, tipHeight)) { if (touch.collider.tag == "Whiteboard") { this.whiteboard = touch.collider.GetComponent <Whiteboard>(); whiteboard.SetColor(myColor); whiteboard.SetTouchPosition(touch.textureCoord.x, touch.textureCoord.y); whiteboard.ToggleTouch(true); if (lastTouch == false) { lastTouch = true; lastAngle = transform.rotation; } } else if (touch.collider.tag == "Wallboard") { this.wallboard = touch.collider.GetComponent <WallBoard>(); wallboard.SetColor(myColor); wallboard.SetTouchPosition(touch.textureCoord.x, touch.textureCoord.y); wallboard.ToggleTouch(true); if (lastTouch == false) { lastTouch = true; lastAngle = transform.rotation; } } } else { whiteboard.ToggleTouch(false); lastTouch = false; } if (lastTouch) { transform.rotation = lastAngle; } }
public async Task Update(Whiteboard boardIn) { var board = await GetById(boardIn.Id); board.Title = boardIn.Title; _ctx.Whiteboards.Update(board); await _ctx.SaveChangesAsync(); }
internal Whiteboard GetById(int id) { Whiteboard data = _repo.GetById(id); if (data == null) { throw new Exception("Invalid id"); } return(data); }
internal Whiteboard Edit(Whiteboard updated) { string sql = @" UPDATE whiteboards SET name = @Name WHERE id = @Id;"; _db.Execute(sql, updated); return(updated); }
internal Whiteboard Edit(Whiteboard updated) { Whiteboard original = GetById(updated.Id); if (updated.CreatorId != original.CreatorId) { throw new Exception("You cannot edit this."); } updated.Name = updated.Name != null ? updated.Name : original.Name; return(_repo.Edit(updated)); }
// Use this for initialization void Start() { // Get our Whiteboard component from the whiteboard object this.whiteboard = GameObject.Find("Whiteboard").GetComponent <Whiteboard>(); Texture2D newTex = new Texture2D(textureSize, textureSize); eraser = newTex.GetPixel(0, 0); isPen = true; }
public void SendBattleWinEvent() { var userProfile = Whiteboard.Get <UserProfile>(GameConstants.Player.PLAYER_PROFILE); RewardEvent rewardEvent = new RewardEvent(); rewardEvent.EventType = RewardEvent.Types.RewardEventType.BattleWin; rewardEvent.UserId = userProfile.UserId; Request request = RequestGenerator.CreateRequest(RequestType.RewardUser, rewardEvent.ToByteString()); NetworkManager.Instance.SendRequest(request, OnRewardReceived); }
internal Whiteboard Delete(int id, string userId) { Whiteboard original = GetById(id); if (userId != original.CreatorId) { throw new Exception("You cannot delete this."); } _repo.Delete(id); return(original); }
// Update is called once per frame void Update() { Vector3 tip = Tip.transform.position; if (NetworkPlayer != null) { if (NetworkPlayer.GlobalSyncingManager.NetworkPlayerIdOfWritingPlayer <= 0 || NetworkPlayer.GlobalSyncingManager.NetworkPlayerIdOfWritingPlayer == NetworkPlayer.netId.Value) { if (Physics.Raycast(tip, transform.up, out hit, RaycastLenght)) { if (!(hit.collider.tag == "Whiteboard")) { return; } //tip is touching whiteboard this.Whiteboard = hit.collider.GetComponent <Whiteboard>(); // set touch position only if touch position change to previous frane if (_lastX != hit.textureCoord.x || _lastY != hit.textureCoord.y) { NetworkPlayer.SetTouchPosition(hit.textureCoord.x, hit.textureCoord.y, Color, 1); } // store touch position _lastX = hit.textureCoord.x; _lastY = hit.textureCoord.y; // if in previous frame the tip didnt touch, set touch to true if (!lastTouch) { NetworkPlayer.ToggleTouch(true); lastTouch = true; lastAngle = transform.rotation; } } // tip is not touching else { // if in previous frame the tip touched, set touch to true if (lastTouch) { NetworkPlayer.ToggleTouch(false); } lastTouch = false; } if (lastTouch) { transform.rotation = lastAngle; } } } }
protected override void OnInitialized() { Whiteboard.OnStroke(async stroke => { await _context.StrokeAsync(stroke); await _context.FlushAsync(); }); Whiteboard.OnWipe(async wipe => { await _context.WipeAsync(wipe); await _context.FlushAsync(); }); Whiteboard.OnFill(async fill => { await _context.FillAsync(fill); await _context.FlushAsync(); }); Whiteboard.OnClear(async clear => { await _context.ClearAsync(clear); await _context.FlushAsync(); }); Whiteboard.OnUndo(async undo => { System.Console.WriteLine("Undo"); await _context.ClearAsync(Clear.All); foreach (var action in Whiteboard.Actions) { if (action is Stroke stroke) { await _context.StrokeAsync(stroke); } else if (action is Wipe wipe) { await _context.WipeAsync(wipe); } else if (action is Fill fill) { await _context.FillAsync(fill); } else if (action is Clear clear) { await _context.ClearAsync(clear); } } await _context.FlushAsync(); }); }
private void Update() { //if (collision.collider.tag == "WritableSurface") //{ // send a raycast out to the whiteboard Vector3 dir; if (isEraser) { dir = -transform.up; } else { dir = transform.right; } if (Physics.Raycast(transform.position, dir, out touchPos, 0.015f)) { if (touchPos.collider.tag == "Whiteboard_Surface") { //Debug.Log("Hit Surface - " + touchPos.collider.gameObject.name); //pos.transform.position = touchPos.point; currentBoard = touchPos.collider.GetComponent <Whiteboard>(); // generate texture blob with correct colour (basically an array of colours, the length of the number of pixels to be drawn) color = Enumerable.Repeat(penColor, penSize * penSize).ToArray(); Debug.Log("Texture Coords: " + touchPos.textureCoord); currentBoard.UpdateTouching(true); currentBoard.UpdateWhiteboard(touchPos.textureCoord, color, penSize); } else { if (currentBoard != null) { currentBoard.UpdateTouching(false); currentBoard = null; } } } else { if (currentBoard != null) { currentBoard.UpdateTouching(false); currentBoard = null; } } // collision.gameObject.GetComponent<Whiteboard>().UpdateWhiteboard(this.transform.position,penColor, penSize); //} }
internal Whiteboard Create(Whiteboard newWhiteboard) { string sql = @" INSERT INTO whiteboards (creatorId, name, public) VALUES (@CreatorId, @Name, @Public); SELECT LAST_INSERT_ID();"; int id = _db.ExecuteScalar <int>(sql, newWhiteboard); newWhiteboard.Id = id; return(newWhiteboard); }
public async Task <ActionResult <Whiteboard> > CreateAsync([FromBody] Whiteboard newWhiteboard) { try { Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>(); newWhiteboard.CreatorId = userInfo.Id; newWhiteboard.Creator = userInfo; return(Ok(_service.Create(newWhiteboard))); } catch (System.Exception err) { return(BadRequest(err.Message)); } }
internal string Create(Stickynote pm) { Whiteboard whiteboard = _whiteboardsrepo.GetById(pm.WhiteboardId); if (whiteboard == null) { throw new Exception("Not a valid whiteboard"); } if (whiteboard.CreatorId != pm.CreatorId) { throw new Exception("You are not the owner of this whiteboard"); } _repo.Create(pm); return("Created"); }
public async Task <Whiteboard> Create(Whiteboard whiteboard) { if (await _ctx.Whiteboards.AnyAsync( w => w.Title == whiteboard.Title && w.User.Id == whiteboard.User.Id)) { throw new WhiteboardException("You already have a whiteboard with this title"); } await _ctx.Whiteboards.AddAsync(whiteboard); await _ctx.SaveChangesAsync(); return(whiteboard); }
// Update is called once per frame void Update() { float tipHeight = transform.Find("Tip").transform.localScale.y; Vector3 tip = transform.Find("Tip/TouchPoint").transform.position; Debug.Log(tip); if (lastTouch) { tipHeight *= 1.1f; } // Check for a Raycast from the tip of the pen if (Physics.Raycast(tip, transform.up, out touch, tipHeight)) { if (!(touch.collider.tag == "Whiteboard")) { return; } this.whiteboard = touch.collider.GetComponent <Whiteboard>(); // Give haptic feedback when touching the whiteboard controllerActions.TriggerHapticPulse(0.05f); // Set whiteboard parameters whiteboard.SetColor(Color.blue); whiteboard.SetTouchPosition(touch.textureCoord.x, touch.textureCoord.y); whiteboard.ToggleTouch(true); // If we started touching, get the current angle of the pen if (lastTouch == false) { lastTouch = true; lastAngle = transform.rotation; } } else { whiteboard.ToggleTouch(false); lastTouch = false; } // Lock the rotation of the pen if "touching" if (lastTouch) { transform.rotation = lastAngle; } }
public async Task <ActionResult <Whiteboard> > Edit([FromBody] Whiteboard updated, int id) { try { Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>(); updated.CreatorId = userInfo.Id; updated.Id = id; updated.Creator = userInfo; return(Ok(_service.Edit(updated))); } catch (System.Exception err) { return(BadRequest(err.Message)); } }
void Start() { var playerStatus = Whiteboard.Get <StartUpResponse.Types.PlayerStatus>(GameConstants.Player.STARTUP_PLAYER_STATUS); var playerProfile = Whiteboard.Get <UserProfile>(GameConstants.Player.PLAYER_PROFILE); if (playerStatus == StartUpResponse.Types.PlayerStatus.PlayerFound) { Util.Log("Player Found"); Hashtable table = new Hashtable(); table.Add(GameConstants.Player.PLAYER_PROFILE, playerProfile); ActionManager.instance.TriggerEvent(StringConstants.EventNames.UPDATE_PLAYER_PROFILE, table); } else if (playerStatus == StartUpResponse.Types.PlayerStatus.PlayerNotFound) { Hashtable table = new Hashtable(); table.Add(StringConstants.PropertyName.EVENT_NAME, StringConstants.EventNames.OPEN_USER_REGISTRATION); ActionManager.instance.TriggerEvent(StringConstants.EventNames.OPEN_USER_REGISTRATION, table); } }
public void HandleStartupResponse(string requestId) { StartUpResponse startUpResponse = NetworkManager.Instance.GetResponse <StartUpResponse>(requestId); Debug.Log(" startup response received "); Debug.Log(" startup status : " + startUpResponse.StartupStatus.ToString()); Debug.Log(" player status : " + startUpResponse.PlayerStatus.ToString()); if (startUpResponse.StartupStatus == StartUpResponse.Types.StartupResponseStatus.MajorUpdate) { ActionManager.instance.TriggerEvent("OpenUserLogin"); //PopupManager.Instance.CreatePopup("Major Update", startUpResponse.Message, "update", null, delegate { // Debug.LogError(" going to update page "); //}); return; } else if (startUpResponse.StartupStatus == StartUpResponse.Types.StartupResponseStatus.MinorUpdate) { //PopupManager.Instance.CreatePopup("Minor Update", startUpResponse.Message, "update", "skip", delegate { // Debug.LogError(" going to update page "); //}, //delegate { //}); } if (startUpResponse.PlayerStatus == StartUpResponse.Types.PlayerStatus.PlayerBanned) { //PopupManager.Instance.CreatePopup("Banned!!", startUpResponse.Message, "update", null, delegate { // Debug.LogError(" close the game "); //}); return; } else if (startUpResponse.PlayerStatus == StartUpResponse.Types.PlayerStatus.PlayerNotFound || startUpResponse.PlayerStatus == StartUpResponse.Types.PlayerStatus.PlayerFound) { Whiteboard.SetProperty(GameConstants.Player.STARTUP_PLAYER_STATUS, startUpResponse.PlayerStatus); Whiteboard.SetProperty(GameConstants.Player.PLAYER_PROFILE, startUpResponse.PlayerProfile); SceneManager.LoadScene("GameScene"); return; } }
// Use this for initialization void Start() { LineRenderer lineRenderer = gameObject.AddComponent <LineRenderer>(); lineRenderer.material = new Material(Shader.Find("Sprites/Default")); lineRenderer.startColor = Color.blue; lineRenderer.endColor = Color.blue; lineRenderer.startWidth = 0.005f; lineRenderer.endWidth = 0.005f; lineRenderer.numCapVertices = 1; lineRenderer.SetPosition(0, transform.position); lineRenderer.SetPosition(1, transform.position); m_bIsDraw = true; m_bIsDrawing = false; m_preForwardVector = new Vector3(0.0f, 0.0f, 0.0f); this.whiteboard = GameObject.Find("Whiteboard").GetComponent <Whiteboard>(); }
public Team() { this.coffeeMachine = new CoffeeMachine(); this.whiteboard = new Whiteboard(); this.networkSwitch = new NetworkSwitch(); this.phone = new Phone(); this.toilet = new Toilet(); this.players = new List <Player>(); for (int i = 0; i < 4; i++) { this.players.Add(new Player(i)); } this.tasks = Task.CreateTaskTree(); // Creates a new tree via the factory method this.completed = new List <Task>(); this.completed.Add(this.tasks); this.available = GetAvailableTasks(); }
public override void Initialize(MacroAIParty party, Faction faction) { RunningNodeHist = new MaxStack <string>(20); MyShip = transform.GetComponent <ShipBase>(); Whiteboard = new Whiteboard(); Whiteboard.Initialize(); //AttackTarget = GameManager.Inst.PlayerControl.PlayerShip; //Whiteboard.Parameters["TargetEnemy"] = AttackTarget; Whiteboard.Parameters["SpeedLimit"] = -1f; MyParty = party; MyFaction = faction; TreeSet = new Dictionary <string, BehaviorTree>(); TreeSet.Add("BaseBehavior", GameManager.Inst.DBManager.XMLParserBT.LoadBehaviorTree("BaseBehavior", this, party)); TreeSet.Add("APTravel", GameManager.Inst.DBManager.XMLParserBT.LoadBehaviorTree("APTravel", this, party)); TreeSet.Add("FollowFriendly", GameManager.Inst.DBManager.XMLParserBT.LoadBehaviorTree("FollowFriendly", this, party)); }
private static Whiteboard CreateStructure() { Whiteboard w = new Whiteboard(); w.EnableDeletion = true; w.EnableFiltering = true; w.EnableHeaders = false; w.Name = "Whiteboard1"; w.PageSize = 8; Whiteboard.Column c1 = new Whiteboard.Column(); c1.Caption = "Patient"; c1.Position = 0; c1.Type = "InPlaceEdit"; w.Columns.Add(c1); Whiteboard.Column c2 = new Whiteboard.Column(); c2.Caption = "Doctor"; c2.Position = 1; c2.Type = "InPlaceEdit"; w.Columns.Add(c2); w.Save(); return w; }
// Use this for initialization void Start() { this.whiteboard = GameObject.Find("Whiteboard").GetComponent <Whiteboard>(); GetComponent <VRTK_ControllerEvents>().TriggerPressed += new ControllerInteractionEventHandler(DoTriggerPressed); }
// Use this for initialization void Start() { // Get our Whiteboard component from the whiteboard object this.whiteboard = GameObject.Find("Whiteboard").GetComponent <Whiteboard>(); }
private void RenderCellToPdf(Section section, Whiteboard.Cell cell) { // Header Paragraph paragraph = section.AddParagraph(); paragraph.Format.SpaceBefore = new Unit(10, UnitType.Point); paragraph.Format.LeftIndent = new Unit(10, UnitType.Point); paragraph.Format.Font.Color = Color.FromCmyk(100, 30, 20, 50); paragraph.AddFormattedText( cell.Column.Caption, TextFormat.Bold); // Value string value = cell.Value ?? ""; paragraph = section.AddParagraph(); paragraph.Format.LeftIndent = new Unit(20, UnitType.Point); paragraph.Format.Font.Color = Color.FromCmyk(100, 120, 120, 120); paragraph.AddFormattedText(value); }
protected void CreateNewWhiteboard(object sender, ActiveEventArgs e) { // Closing window... ActiveEvents.Instance.RaiseClearControls("dynPopup"); string name = e.Params["WhiteboardName"].Get<string>(); Whiteboard w = new Whiteboard {Name = name}; w.Save(); // Open whiteboard that was just created... EditWhiteboard(w.ID); RefreshMenu(); ActiveEvents.Instance.RaiseActiveEvent( this, "WhiteboardWasCreated"); }