コード例 #1
0
ファイル: BOX.cs プロジェクト: danceruler/mzhShop
        /// <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()));
                }
            }
        }
コード例 #2
0
ファイル: MovingBox.cs プロジェクト: 1026438521/hack
 void removeSelf()
 {
     _BoxState = BoxState.Box_Destroyed;
     _MoveTo.stopTask();
     _MoveTo = null;
     Destroy(gameObject);
 }
コード例 #3
0
ファイル: Box.cs プロジェクト: mayankmittal192/DotsAndBoxes
 // 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);
 }
コード例 #4
0
ファイル: Box.cs プロジェクト: mayankmittal192/DotsAndBoxes
    // 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;
        }
    }
コード例 #5
0
ファイル: XuLiState.cs プロジェクト: gitchenjiangkun/Jump
 public void IUpdate()
 {
     XuLipar();
     BoxState.BoxSmallFun();
     GameData.PlayerInput.PlayerSmall();
     LoopXuli();
 }
コード例 #6
0
ファイル: JumpState.cs プロジェクト: gitchenjiangkun/Jump
 public void IUpdate()
 {
     JumpRote(GoMgr.Player);
     GameData.PlayerInput.PlayerLargen();
     BoxState.BoxLargen();
     OpenBoxCollider();
 }
コード例 #7
0
 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);
 }
コード例 #8
0
    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);
    }
コード例 #9
0
ファイル: BaseBoxTool.cs プロジェクト: NCC-Lykos/Chisel
        protected BaseBoxTool()
        {
            Usage = ToolUsage.Both;
            State = new BoxState();

            _printer     = new TextPrinter(TextQuality.Low);
            _printerFont = new Font(FontFamily.GenericSansSerif, 16, GraphicsUnit.Pixel);
        }
コード例 #10
0
ファイル: BaseBoxTool.cs プロジェクト: KonstantinUb/sledge
        protected BaseBoxTool()
        {
            Usage = ToolUsage.Both;
            State = new BoxState();

            _printer = new TextPrinter(TextQuality.Low);
            _printerFont = new Font(FontFamily.GenericSansSerif, 16, GraphicsUnit.Pixel);
        }
コード例 #11
0
ファイル: Box.cs プロジェクト: lihaochen910/2DBoxPuzzle
 /* 检查自身状态 */
 private void CheckSelf()
 {
     State = getCurrentState();
     if (State == BoxState.Isolated)
     {
         _linkedPosition = calcDropPosition();
         To_be_synchronized_object.Enqueue(this);
     }
 }
コード例 #12
0
        /// <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();
        }
コード例 #13
0
ファイル: BoxController.cs プロジェクト: danceruler/mzhShop
        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
                       ));
        }
コード例 #14
0
 public void SetDying()
 {
     isDying = true;
     state   = BoxState.dying;
     if (animator != null)
     {
         animator.SetTrigger("die");
     }
 }
コード例 #15
0
ファイル: Game.cs プロジェクト: ethiele/TickTackToe
        public Game()
        {
            GameGrid = new BoxState[GirdSize][];
            for (int i = 0; i < GirdSize; i++)

            {
                GameGrid[i] = new BoxState[GirdSize];
            }
        }
コード例 #16
0
 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);
 }
コード例 #17
0
 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;
 }
コード例 #18
0
 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;
     }
 }
コード例 #19
0
ファイル: Box.cs プロジェクト: ar1st0crat/Sokoban3D
    public void ChangeState(BoxStates state)
    {
        if (_state != null)
        {
            _state.Dispose();
            _state = null;
        }

        _state = _stateFactory.CreateState(state);
        _state.Start();
    }
コード例 #20
0
    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);
    }
コード例 #21
0
        /// <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();
        }
コード例 #22
0
    //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;
    }
コード例 #23
0
    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);
        }
    }
コード例 #24
0
 // 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;
     }
 }
コード例 #25
0
ファイル: CityBox.cs プロジェクト: howelllucas/Project
        public void SetBoxState(BoxState st)
        {
            if (state == st)
            {
                return;
            }

            state     = st;
            stateTime = boxTime;
            PlayAnim();
        }
コード例 #26
0
    public void ShowBox()
    {
        if (thisBoxState == BoxState.Shown)
        {
            return;
        }

        Tween.AnchoredPosition(rectTransform, shownPos, tweenTime, 0f, curve1);

        thisBoxState = BoxState.Shown;
    }
コード例 #27
0
 public int?this[BoxState state]
 {
     get
     {
         return(_dictBoxCounts.Where(p => p.Key == state).Sum(p => p.Value));
     }
     set
     {
         _dictBoxCounts[state] = value;
     }
 }
コード例 #28
0
 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;
     }
 }
コード例 #29
0
    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();
            }
        }
    }
コード例 #30
0
        public bool HasBoxWithState(BoxState state)
        {
            foreach (Box box in boxes)
            {
                if (box.State == state)
                {
                    return(true);
                }
            }

            return(false);
        }
コード例 #31
0
 public void SetFading()
 {
     if (Utilites.scoreMode == Utilites.ScoreMode.fadeEqDie)
     {
         isDying = true;
     }
     state = BoxState.fading;
     if (animator != null)
     {
         animator.SetTrigger("fade");
     }
 }
コード例 #32
0
        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);
        }
コード例 #33
0
ファイル: DialogBox.cs プロジェクト: kevincos/Vexed
        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;
        }
コード例 #34
0
ファイル: DialogBox.cs プロジェクト: kevincos/Vexed
 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;
 }
コード例 #35
0
ファイル: BaseBoxTool.cs プロジェクト: jpiolho/sledge
 protected BaseBoxTool()
 {
     Usage = ToolUsage.Both;
     State = new BoxState();
 }
コード例 #36
0
ファイル: DialogBox.cs プロジェクト: kevincos/Vexed
        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;
        }
コード例 #37
0
ファイル: DialogBox.cs プロジェクト: kevincos/Vexed
        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;
                }
            }
        }