/// <summary> /// 更新包厢 /// </summary> /// <param name="boxid"></param> /// <param name="state"></param> /// <param name="name"></param> /// <returns></returns> public ResultModel UpdateBox(int boxid, BoxState state, string name, decimal price, decimal bookprice) { using (brnshopEntities context = new brnshopEntities()) { var tran = context.Database.BeginTransaction(); try { var box = context.bsp_boxes.SingleOrDefault(t => t.boxid == boxid); if (box == null) { return(ResultModel.Fail("该包厢已删除,请刷新")); } box.state = (int)state; box.name = name; box.price = price; box.bookprice = bookprice; if (state == BoxState.Empty) { box.username = ""; box.phone = ""; } context.SaveChanges(); tran.Commit(); new BoxCache().Init(); return(ResultModel.Success("修改成功")); } catch (Exception ex) { tran.Rollback(); Logger._.Error(ex); return(ResultModel.Error(ex.ToString())); } } }
void removeSelf() { _BoxState = BoxState.Box_Destroyed; _MoveTo.stopTask(); _MoveTo = null; Destroy(gameObject); }
// Runs only once at the start of the game loop public void Start() { State = BoxState.Unsaturated; hasCompleted = false; rend = GetComponent <SpriteRenderer>(); rend.material.SetColor(App.SpriteRenderer.MainColorProperty, App.ColorPalette.Black); }
// Updates state on the basis of the number of filled neighbour/boundary edges public void UpdateState(int filledNeighbourCount, Color currentPlayerColor, out bool completedJustNow) { completedJustNow = false; switch (filledNeighbourCount) { case 0: case 1: State = BoxState.Unsaturated; break; case 2: State = BoxState.Saturated; break; case 3: State = BoxState.Trigger; break; case 4: State = BoxState.Complete; HandleCompletion(currentPlayerColor, out completedJustNow); break; } }
public void IUpdate() { XuLipar(); BoxState.BoxSmallFun(); GameData.PlayerInput.PlayerSmall(); LoopXuli(); }
public void IUpdate() { JumpRote(GoMgr.Player); GameData.PlayerInput.PlayerLargen(); BoxState.BoxLargen(); OpenBoxCollider(); }
void SetFixed() { m_CurCoord = m_TargetCoord; m_CurPos = m_TargetPos; m_State = BoxState.FIX; m_CurTime = m_BG.m_FallingTime; m_BG.SetElementByCoord(m_CurCoord, gameObject); }
public void ShowGameFinishWindow(BoxState winBoxState) { GameObject go = Instantiate(Resources.Load("WInCanvas")) as GameObject; go.GetComponent <RectTransform>().localPosition = new Vector3(960f, 540f, 0); go.GetComponent <CWindowGameFinish>().Show(winBoxState); }
protected BaseBoxTool() { Usage = ToolUsage.Both; State = new BoxState(); _printer = new TextPrinter(TextQuality.Low); _printerFont = new Font(FontFamily.GenericSansSerif, 16, GraphicsUnit.Pixel); }
/* 检查自身状态 */ private void CheckSelf() { State = getCurrentState(); if (State == BoxState.Isolated) { _linkedPosition = calcDropPosition(); To_be_synchronized_object.Enqueue(this); } }
/// <summary>Handles the MouseDown event of the pictureBox1 control to start a resize, placement or movement event.</summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="MouseEventArgs"/> instance containing the event data.</param> private void pictureBox1_MouseDown(object sender, MouseEventArgs e) { // Starting point of the selection: if (e.Button == MouseButtons.Left) { if (!_placed) { _selection = new Rectangle(new Point(e.X, e.Y), new Size()); _movement_point = new Point(e.X, e.Y); _placed = true; _state = BoxState.Placing; } else { if ((e.X > _selection.X - BoxWidth && e.X < _selection.X + _selection.Width + BoxWidth) && (e.Y > _selection.Y - BoxWidth && e.Y < _selection.Y + _selection.Height + BoxWidth)) { var resizeMask = GetFlags(e.X, e.Y); if (resizeMask == BoxFlags.All) { _state = BoxState.Moving; _box_flags = resizeMask; _movement_point = new Point(e.X - _selection.X, e.Y - _selection.Y); this.Text = string.Format("MouseDown({0}, {1}, {2})", e.X, e.Y, _state); } else if (resizeMask != BoxFlags.None) { _state = BoxState.Resizing; _box_flags = resizeMask; int x = e.X, y = e.Y; if ((_box_flags | BoxFlags.Right) == BoxFlags.Right) { x = (_selection.X + _selection.Width) - e.X; } if ((_box_flags | BoxFlags.Bottom) == BoxFlags.Bottom) { y = (_selection.Y + _selection.Height) - e.Y; } _movement_point = new Point(x, y); this.Text = string.Format("MouseDown({0}, {1}, {2})", e.X, e.Y, _state); } } else { _selection = new Rectangle(new Point(e.X, e.Y), new Size()); _movement_point = new Point(e.X, e.Y); _state = BoxState.Placing; } } } pcFullImage.Refresh(); }
public ActionResult UpdateBox(int boxid, BoxState state, string name, decimal price, decimal bookprice) { BOX box = RemotingHelp.GetModelObject <BOX>(); return(Json( box.UpdateBox(boxid, state, name, price, bookprice), JsonRequestBehavior.AllowGet )); }
public void SetDying() { isDying = true; state = BoxState.dying; if (animator != null) { animator.SetTrigger("die"); } }
public Game() { GameGrid = new BoxState[GirdSize][]; for (int i = 0; i < GirdSize; i++) { GameGrid[i] = new BoxState[GirdSize]; } }
public void GoToCoord(Coord2D coord) { m_State = BoxState.FALL; m_CurPos = m_BG.CoordToPos(m_TargetCoord); m_TargetCoord = coord; m_CurTime = 0; m_BG.SetElementByCoord(m_CurCoord, null); m_BG.SetElementByCoord(coord, gameObject); m_TargetPos = m_BG.CoordToPos(m_TargetCoord); }
public void SetCoord(Coord2D coord) { m_CurCoord = coord; m_TargetCoord = coord; m_CurTime = m_BG.m_FallingTime; m_State = BoxState.FALL; m_BG.SetElementByCoord(coord, gameObject); m_CurPos = m_BG.CoordToPos(m_CurCoord); m_TargetPos = m_CurPos; }
public int?this[PiecesKind kind, BoxState state] { get { return(_dictPieces.Where(p => p.Key.Item1 == state && p.Key.Item2 == kind).Sum(p => p.Value)); } set { _dictPieces[Tuple.Create(state, kind)] = value; } }
public void ChangeState(BoxStates state) { if (_state != null) { _state.Dispose(); _state = null; } _state = _stateFactory.CreateState(state); _state.Start(); }
public bool checkGameFinish() { bool findedMatch = false; for (int lineIndex = 0; lineIndex < mWinLines.Count; lineIndex++) //пербираем массив линий { Vector2Int[] line = (Vector2Int[])mWinLines[lineIndex]; //назначем в массив линии значения из массива линий int matchCounter = 0; BoxState lastBoxState = BoxState.eObjectEmpty; for (int i = 0; i < line.Length - 1; i++) // перебираем сами линии { Vector2Int point = line[i]; // объявляем перменную и присвемваем ей первое значение из массива линии BoxState currentBoxState = mFieldData.getValueByCell(point.x, point.y); point = line[i + 1]; // присвемваем перменной второе значение из массива линии BoxState nextBoxState = mFieldData.getValueByCell(point.x, point.y); lastBoxState = nextBoxState; if ((currentBoxState != BoxState.eObjectEmpty) && (nextBoxState != BoxState.eObjectEmpty)) { if (currentBoxState == nextBoxState) { matchCounter++; } else { break; } } } if (matchCounter == 2) { findedMatch = true; for (int j = 0; j < mPlayersArray.Count; j++) { if (mPlayersArray[j].GetBoxKind() == lastBoxState) { mPlayersArray[j].SetState(EPlayerState.ePlayerWinner); mPlayersArray[j].WinCount += 1; //AddWinnerCount(CountPlayerO, CountPlayerX); } } break; } } return(findedMatch); }
/// <summary>Handles the MouseUp event of the pictureBox1 control to finsh the resize, placement or movement event.</summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="MouseEventArgs"/> instance containing the event data.</param> private void pictureBox1_MouseUp(object sender, MouseEventArgs e) { if (_state != BoxState.None) { cmdProcess.PerformClick(); SaveSettings(); _state = BoxState.None; } pcFullImage.Refresh(); }
//private void Update() //{ // if (Input.GetKeyDown(KeyCode.Space)) // { // if (thisBoxState == BoxState.Hidden) // { // ShowBox(); // } // else if (thisBoxState == BoxState.Shown) // { // HideBox(); // } // } //} public void HideBox() { if (thisBoxState == BoxState.Hidden) { return; } Tween.AnchoredPosition(rectTransform, hiddenPos, tweenTime, 0f, curve1); thisBoxState = BoxState.Hidden; }
public void AnimatedBoxState(Vector2 position, BoxState newboxStt) { int x = (int)position.x; int y = (int)position.y; CGameViewObject curentBox = grid[x, y]; if (curentBox.currentBoxState != newboxStt) { curentBox.SetBoxState(newboxStt); } }
// Closes the dialogue box if it is currently showing void CloseBox() { if (textState == TextState.WRITING) { Debug.Log("Someone tried to close the dialogue box while it was writing text!"); } else if (boxState == BoxState.OPEN || boxState == BoxState.OPENING) { boxState = BoxState.CLOSING; } }
public void SetBoxState(BoxState st) { if (state == st) { return; } state = st; stateTime = boxTime; PlayAnim(); }
public void ShowBox() { if (thisBoxState == BoxState.Shown) { return; } Tween.AnchoredPosition(rectTransform, shownPos, tweenTime, 0f, curve1); thisBoxState = BoxState.Shown; }
public int?this[BoxState state] { get { return(_dictBoxCounts.Where(p => p.Key == state).Sum(p => p.Value)); } set { _dictBoxCounts[state] = value; } }
public void SetState(BoxState state) { _State = state; if (state == BoxState.EmptyBox) { //gameObject.GetComponent<FollowMouse> ().enabled = false; } else if (state == BoxState.FullBox) { //gameObject.GetComponent<FollowMouse> ().enabled = false; } }
void revelarBox() { position.changeMine(this); if (boxState == BoxState.Hidden) { if (mined) { sprite.color = Color.red; position.GameOver(); } else { position.SumarDescubiertos(); int minasRodeando = conocerCantidad(); if (minasRodeando != 0) { minesAround = (byte)minasRodeando; sprite.sprite = mineSprites[minasRodeando + 2]; boxState = BoxState.Revealed; } else { sprite.sprite = mineSprites[0]; } } } else if (boxState == BoxState.Revealed) { byte flagCount = 0; BoxController boxScript; Object[] allBox = GameObject.FindGameObjectsWithTag("Box"); foreach (GameObject boxGO in allBox) { boxScript = boxGO.GetComponent <BoxController>(); for (int y = -1; y <= 1; y++) { for (int x = -1; x <= 1; x++) { if (!(boxPositionHeight + y < 0 || boxPositionWidth + x < 0 || boxPositionHeight + y >= PositionController.heightMines || boxPositionWidth + x >= PositionController.widthMines) && (boxScript.boxPositionHeight == boxPositionHeight + y && boxScript.boxPositionWidth == boxPositionWidth + x && boxScript.boxState == BoxState.Flag)) { flagCount++; } } } } if (flagCount == minesAround) { revealAroundBoxes(); } } }
public bool HasBoxWithState(BoxState state) { foreach (Box box in boxes) { if (box.State == state) { return(true); } } return(false); }
public void SetFading() { if (Utilites.scoreMode == Utilites.ScoreMode.fadeEqDie) { isDying = true; } state = BoxState.fading; if (animator != null) { animator.SetTrigger("fade"); } }
public List <Box> GetBoxesWithState(BoxState state) { List <Box> boxesToReturn = new List <Box>(); foreach (Box box in boxes) { if (box.State == state) { boxesToReturn.Add(box); } } return(boxesToReturn); }
public static void SetCustomDialog(String message) { currentDialog = new DialogChunk(); currentDialog.pause = false; currentDialog.textList = new List<string>(); currentDialog.textList.Add(message); currentDialog.FitToBox(); currentDialog.speaker = SpeakerId.OldMan; currentDialog.id = "Custom"; if (currentDialog.pause == true) Engine.player.state = State.Dialog; stage = 0; lifeTime = 0; animationTime = 0; state = BoxState.Appear; }
public bool Next() { if (currentDialog == null) { if (state != BoxState.Close) { state = BoxState.Close; if(IntroOverlay.state != IntroState.FadeIn) SoundFX.DialogExtend(); } animationTime = 0; return false; } if (cooldown > 0) return true; stage++; cooldown = 300; state = BoxState.Text; animationTime = 0; currentCharacter = 0; currentText = ""; if (stage >= currentDialog.textList.Count) { state = BoxState.Close; animationTime = 0; return false; } return true; }
protected BaseBoxTool() { Usage = ToolUsage.Both; State = new BoxState(); }
public static void SetDialog(String id) { foreach (DialogChunk chunk in dialogLibrary) { if (chunk.id == id) { currentDialog = chunk; currentDialog.FitToBox(); } } if(currentDialog.pause == true) Engine.player.state = State.Dialog; stage = 0; lifeTime = 0; animationTime = 0; state = BoxState.Appear; }
public void Update(int gameTime) { if (DialogBox.currentFont == null) DialogBox.currentFont = DialogBox.newFont; if (currentFont != newFont) { currentFont = newFont; } lifeTime += gameTime; animationTime += gameTime; if (state == BoxState.Appear) { if (animationTime > appearMaxTime) { SoundFX.DialogExtend(); state = BoxState.Extend; animationTime = 0; } } else if (state == BoxState.Extend) { if (animationTime > extendMaxTime) { state = BoxState.Text; currentText = ""; currentCharacter = 0; animationTime = 0; } } else if (state == BoxState.Vanish) { if (animationTime > appearMaxTime) { state = BoxState.None; animationTime = 0; } } else if (state == BoxState.Close) { if (animationTime > extendMaxTime) { state = BoxState.Vanish; animationTime = 0; } } if (state == BoxState.Text) { bool playSound = false; while (animationTime > charMaxTime && state == BoxState.Text) { currentText += currentDialog.textList[stage][currentCharacter]; if (currentDialog.textList[stage][currentCharacter] != ' ' && currentDialog.textList[stage][currentCharacter] != '\n') playSound = true; currentCharacter++; animationTime -= charMaxTime; lifeTime = 0; if (currentCharacter >= currentDialog.textList[stage].Length) state = BoxState.Wait; } if(playSound) SoundFX.DialogCharacter(); } cooldown -= gameTime; if (cooldown < 0) cooldown = 0; if (Engine.player.state == State.Dialog) { lifeTime = 0; } else { if (lifeTime > maxLifeTime && state != BoxState.Close && state != BoxState.Vanish && state != BoxState.None) { state = BoxState.Close; SoundFX.DialogExtend(); animationTime = 0; } } }