Example #1
0
 public Tile(int startingIndex, string imageName, PuzzlePanel puzzle) : base()
 {
     this.startingIndex = startingIndex;
     this.imageName     = imageName;
     this.puzzle        = puzzle;
     Build();
 }
Example #2
0
 public ItemPanel() : base()
 {
     puzzlePanel       = new PuzzlePanel();
     addThemeDialog    = new AddThemeDialog();
     changeThemeDialog = new ChangeThemeDialog();
     Build();
 }
Example #3
0
        public void TestToString()
        {
            var p = new PuzzlePanel(1);

            Assert.AreEqual("[ 1]", p.ToString());

            Assert.AreEqual("    ", PuzzlePanel.Free.ToString());
        }
Example #4
0
 public Matching(PuzzlePanel panel, Pattern pattern, int x, int y, BlockEntity2 blockEntity, Block[] blocks)
 {
     this.panel = panel;
     this.pattern = pattern;
     this.x = x;
     this.y = y;
     this.blockEntity = blockEntity;
     this.blocks = blocks;
     remainChargeTime = ChargeTime;
 }
        private void endSession()
        {
            Session.EndSession();
            PuzzleEngine.EndSession();

            puzzlePanel  = null;
            pickerPanel  = null;
            creditsPanel = new CreditsPanel(this);
            sessionReset();
        }
Example #6
0
 public Board(Rect boardRect, PuzzlePanel puzzlePanel, E_HeroType heroType, MatchingHandler matchHandler, Handler onMatchStart, Handler onMatchFinish, TimeClient timeClient)
 {
     layout = new PuzzleLayout(boardRect);
     this.puzzlePanel = puzzlePanel;
     this.blocks = TableLoader.GetTable<BlockEntity>().GetMany(heroType).Select(x => x.Value).ToDictionary(x => x.BlockType);
     this.blockGenerator = new Block.Generator(heroType);
     this.matchHandler = matchHandler;
     this.onMatchStart = onMatchStart;
     this.onMatchFinish = onMatchFinish;
     fsm = new FSM("PuzzleBoard.fsm", this);
 }
Example #7
0
        private void InitializeConstrols()
        {
            button_size = 10;

            gamePanel      = Puzzle.Instance.View;
            gamePanel.Left = 0;
            gamePanel.Top  = 0;

            int height = gamePanel.Height;

            if (height < 130)
            {
                height = 130;
            }
            parent.Parent.MakeResize(new ResizeArgs(height + 4 * button_size, gamePanel.Width + (int)(1.6 * button_size) + 110));
            this.Size = parent.Size;

            PuzzleController.Instance.SolvedEvent += EndHandler;


            this.Controls.Add(gamePanel);

            timeLabel      = new Label();
            timeLabel.Name = "Time";
            timeLabel.Text = string.Format("{0}:{1:00}:{2:00}", 0, 0, 0);
            timeLabel.Font = new System.Drawing.Font(
                new System.Drawing.FontFamily(System.Drawing.Text.GenericFontFamilies.Serif),
                15,
                System.Drawing.FontStyle.Bold);
            timeLabel.Size = new System.Drawing.Size(90, 50);
            timeLabel.Left = (this.Size.Width - timeLabel.Width - 10);
            timeLabel.Top  = 10;

            this.Controls.Add(timeLabel);


            backButton             = new Button();
            backButton.Name        = "Back";
            backButton.Text        = "Back";
            backButton.Size        = new System.Drawing.Size(90, 50);
            backButton.Left        = (this.Size.Width - backButton.Width - 10);
            backButton.Top         = (this.Size.Height - backButton.Height - 10);
            backButton.MouseClick += this.ChoosedBack;

            this.Controls.Add(backButton);


            timer          = new Timer();
            timer.Interval = 500;
            timer.Tick    += TimeUpdate;
            timer.Start();
        }
Example #8
0
 public void ChangeBlock(E_BlockType from, E_BlockType to, PuzzlePanel.BlockChangeHandler blockChangeHandler)
 {
     blocks.ForAll(
         delegate(int x, int y, ref Block cell, ref bool stop)
         {
             if (cell != null && cell.blockType == from)
             {
                 cell.ChangeTo(to);
                 blockChangeHandler(from, to, x, y);
             }
         }
     );
 }
Example #9
0
    public Matching(PuzzlePanel panel, Pattern pattern, int x, int y, BlockEntity blockEntity, Block[] blocks)
    {
        this.panel = panel;
        this.pattern = pattern;
        this.x = x;
        this.y = y;
        this.blockEntity = blockEntity;
        this.blocks = blocks;

        chargeCount = 0;
        chargePoint = 0;
        blockCommandEntity = blockCommandTable.Get(blockEntity.HeroType, blockEntity.BlockType, chargeCount);
        AttachEffect(blockCommandEntity);
    }
Example #10
0
    public HeroCharacter(ObjectField objectField, ItemHeroEntity heroEntity, ItemHeroLevel itemHeroLevel, int[] equipIds, bool toLeft, InGameUser user, PuzzlePanel puzzlePanel, Buff.Handle onBuff, Buff.Handle onDeBuff)
        : base(E_OverlapEvent.Collision, objectField, toLeft)
    {
        this.heroEntity = heroEntity;
        this.user = user;
        this.puzzlePanel = puzzlePanel;

        InitStat(itemHeroLevel.Level, equipIds);
        InitStatus(onBuff, onDeBuff);
        RegistActions();

        int skillId = heroEntity.ActiveSkill1;
        SkillCommand skillCommand = InitSkill(this, skillId, itemHeroLevel.Level);
        AddCommandSet("skill", 1, false, E_CommandConsume.Skill, null).TryAdd(skillCommand);
    }
Example #11
0
        public PuzzleCog(PuzzlePanel parent, int shapeKey, Color shapeColor,
                         Vector2 cogPosition,
                         Vector2 cogArmPosition, Vector2 cogArmOrigin, Vector2 armPosition,
                         CogRotationDirection cogArmDirection,
                         CogRotationDirection cogDirection)
        {
            movementType = CogMovementType.Rotate;

            this.parent          = parent;
            this.shapeKey        = shapeKey;
            this.shapeColor      = shapeColor;
            this.startPosition   = cogArmPosition;
            this.endPosition     = cogPosition;
            this.cogArmOrigin    = cogArmOrigin;
            this.armPosition     = armPosition;
            this.cogArmDirection = cogArmDirection;
            this.cogDirection    = cogDirection;
            this.startScale      = 1f;
        }
Example #12
0
        private void InitializeConstrols()
        {
            button_size = 10;

            gamePanel      = Puzzle.Instance.View;
            gamePanel.Left = 0;
            gamePanel.Top  = 0;

            int height = gamePanel.Height;

            if (height < 130)
            {
                height = 130;
            }
            parent.Parent.MakeResize(new ResizeArgs(height + 4 * button_size, gamePanel.Width + (int)(1.6 * button_size) + 110));
            this.Size = parent.Size;


            this.Controls.Add(gamePanel);

            doneButton             = new Button();
            doneButton.Name        = "Done";
            doneButton.Text        = "Done";
            doneButton.Size        = new System.Drawing.Size(90, 50);
            doneButton.Left        = (this.Size.Width - doneButton.Width - 10);
            doneButton.Top         = 10;
            doneButton.MouseClick += this.ChoosedDone;

            this.Controls.Add(doneButton);


            backButton             = new Button();
            doneButton.Name        = "Back";
            backButton.Text        = "Back";
            backButton.Size        = new System.Drawing.Size(90, 50);
            backButton.Left        = (this.Size.Width - backButton.Width - 10);
            backButton.Top         = (this.Size.Height - backButton.Height - 10);
            backButton.MouseClick += this.ChoosedBack;

            this.Controls.Add(backButton);
        }
Example #13
0
        public PuzzleCog(PuzzlePanel parent, int shapeKey, Color shapeColor,
                         Vector2 startPosition, Vector2 phase1Position,
                         Vector2 endPosition, Vector2 armPosition,
                         float startScale, float endScale,
                         CogSlideDirection slideDirection,
                         CogRotationDirection cogDirection)
        {
            movementType = CogMovementType.Slide;

            this.parent         = parent;
            this.shapeKey       = shapeKey;
            this.shapeColor     = shapeColor;
            this.startPosition  = startPosition;
            this.phase1Position = phase1Position;
            this.endPosition    = endPosition;
            this.armPosition    = armPosition;
            this.startScale     = startScale;
            this.endScale       = endScale;
            this.cogDirection   = cogDirection;
            this.slideDirection = slideDirection;
        }
Example #14
0
    public PuzzleEffectControl(PuzzlePanel panel, List<Matching> matches, int chainCount)
    {
        this.panel = panel;
        this.matches = matches;
        this.chainCount = chainCount;

        foreach (var entity in matches)
        {
            if (entity.pattern.Count > 3)
            {
                if (entity.pattern.height == 1)
                {
                    inARowHorizontal.Add(entity);
                }
                else
                {
                    inARowVertical.Add(entity);
                }
            }
        }
    }
Example #15
0
    public Board(Rect boardRect, PuzzlePanel puzzlePanel, Dart<BlockEntity2> dart, bool permitStartingMatch, MatchingHandler matchHandler, Handler onMatchStart, Handler onMatchFinish, TimeClient timeClient)
    {
        layout = new PuzzleLayout(boardRect);
        this.puzzlePanel = puzzlePanel;
        this.blockGenerator = new Block.Generator(dart);
        this.matchHandler = matchHandler;
        this.onMatchStart = onMatchStart;
        this.onMatchFinish = onMatchFinish;
        fsm = new FSM("PuzzleBoard.fsm", this);

        this.typeToEntity = new Dictionary<BlockType, BlockEntity2>();
        foreach (var entity in dart.Values)
        {
            typeToEntity.Add(entity.blockType, entity);
        }

        FillWithoutAni();
        if (!permitStartingMatch)
        {
            RemoveMatch();
        }
    }
Example #16
0
    public HeroCharacter(FieldObjectEntity objectField, SubClassEntity subClassEntity, ClassLevelEntity levelEntity, TrainLevelEntity trainLevelEntity, bool toLeft, InGameUser user, PuzzlePanel puzzlePanel, Buff.Handle onBuff, Buff.Handle onDeBuff, FSM parentFsm)
        : base(objectField, toLeft, parentFsm)
    {
        this.subClassEntity = subClassEntity;
        this.user = user;
        this.puzzlePanel = puzzlePanel;

        this.stat = new Stat2<HeroStatType>(StatGenerator.ExportData<HeroStatType>(levelEntity, trainLevelEntity));
        this.status = InitStatus(this, stat, subClassEntity);

        Register(stat);
        Register(status);

        /*
        RegisterDeathCondition(x => x.Get(HeroStatusType.hp) == 0);
        RegisterBuffHandler(onBuff, onDeBuff);

        RegistActions();

        SkillCommand skillCommand = InitSkill(this, skillId, itemHeroLevel.Level);
        AddCommandSet("skill", 1, false, E_CommandConsume.Skill, null).TryAdd(skillCommand);
         * */
    }
Example #17
0
 public BlankTile(int startingIndex, PuzzlePanel puzzle) : base(startingIndex, null, puzzle)
 {
 }
Example #18
0
 static void CreatePuzzle(StageEntity stageEntity, E_HeroType heroType, Rect puzzleArea, TimeClient timeClient, out PuzzleRecord puzzleRecord, out PuzzlePanel puzzlePanel)
 {
     puzzleRecord = new PuzzleRecord();
     puzzlePanel = new PuzzlePanel(puzzleArea, heroType, stageEntity.GameModeType, puzzleRecord, timeClient);
 }
Example #19
0
    public void ChangeBlock(BlockType[] from, BlockType to, PuzzlePanel.BlockChangeHandler blockChangeHandler)
    {
        nextSequence = new Sequence(sequence.ExportMatrix());
        foreach (var entity in from)
        {
            //nextSequence.ChangeBlock(entity, to, blockChangeHandler);
        }

        fsm.Event("ChangeBlock");
    }
Example #20
0
 static void CreatePuzzle(Rect puzzleArea, TimeClient timeClient, int subClassCode, out PuzzleRecord puzzleRecord, out PuzzlePanel puzzlePanel)
 {
     puzzleRecord = new PuzzleRecord();
     puzzlePanel = new PuzzlePanel(puzzleArea, subClassCode, puzzleRecord, timeClient);
 }
Example #21
0
    static HeroCharacter CreateCharacter(FieldObjectEntity objectField, ClassLevelEntity levelEntity, TrainLevelEntity trainLevelEntity, SubClassEntity subClassEntity, InGameUser user, PuzzlePanel puzzlePanel, ConsumableSpawn itemDropManager, System.Action<StatusEffectEntity2> addBuffIcon, System.Action<StatusEffectEntity2> removeBuffIcon, FSM parentFsm)
    {
        Buff.Handle onBuff = delegate(Buff buff)
        {
            if (addBuffIcon != null)
            {
                addBuffIcon(buff.statusEffectEntity);
            }
        };
        Buff.Handle onDeBuff = delegate(Buff buff)
        {
            if (removeBuffIcon != null)
            {
                removeBuffIcon(buff.statusEffectEntity);
            }
        };
        HeroCharacter heroCharacter = new HeroCharacter(objectField, subClassEntity, levelEntity, trainLevelEntity, false, user, puzzlePanel, onBuff, onDeBuff, parentFsm);

        {
            Action action = ActionPattern.Create("Vector(Self; [HeroStatType.moveSpeed]; 0; 0; false)").Generate(heroCharacter.Stat);
            heroCharacter.Fire(action, null);
            heroCharacter.PauseMoving();
        }

        for (int i = 0; i < 4; i++)
        {
            heroCharacter.AddItemSlot(i, user.commandQueue);
        }

        {
            heroCharacter.AddAction(Action.E_Type.Money,
                delegate(float value, GameInstance firer, string[] param)
                {
                    Action action = ActionPattern.Create("Action(User; Money; {0})").Generate(heroCharacter.Stat, value);
                    if (action != null)
                    {
                        heroCharacter.Fire(action, null);
                    }
                    return null;
                }
            );
            heroCharacter.AddAction(Action.E_Type.Exp,
                delegate(float value, GameInstance firer, string[] param)
                {
                    Action action = ActionPattern.Create("Action(User; Exp; {0})").Generate(heroCharacter.Stat, value);
                    if (action != null)
                    {
                        heroCharacter.Fire(action, null);
                    }
                    return null;
                }
            );
            heroCharacter.AddAction(Action.E_Type.GetConsumable,
                delegate(float value, GameInstance firer, string[] param)
                {
                    if (RandomTool.IsIn(value))
                    {
                        var itemCommand = new ItemCommand(itemDropManager.Pick());
                        if (itemCommand != null)
                        {
                            heroCharacter.TryAddItem(itemCommand);
                        }
                    }
                    return null;
                }
            );
        }

        return heroCharacter;
    }
        public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen)
        {
            base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);

            if (!InputManager.IsPlayerIndexDetected)
            {
//                System.Diagnostics.Debug.WriteLine($"-BEFOR- IsPlayerIndexDetected: {InputManager.IsPlayerIndexDetected}");
                InputManager.DetectPlayerIndex();
//                System.Diagnostics.Debug.WriteLine($"-AFTER- IsPlayerIndexDetected: {InputManager.IsPlayerIndexDetected}");
            }

            StorageManager.Instance.Update(gameTime);

            if (PuzzleEngine.IsCheckRender)
            {
                PuzzleEngine.RenderTextures();
            }

            switch (mode)
            {
            case MainGameScreenMode.ShowSignIn:
                if (signInTask == null)
                {
                    signInTask = SignInManager.Instance.SignIn();
                }

                /*
                 * else if (signInTask.IsCompleted)
                 * {
                 *  if (signInTask.Result)
                 *  {
                 *      // sign-in successful
                 *      mode = MainGameScreenMode.Closed;
                 *  }
                 *  else
                 *  {
                 *      // sign-in failure
                 *      mode = MainGameScreenMode.HandleSignInFailure;
                 *  }
                 *  signInTask = null;
                 * }
                 */
                else
                {
                    ShowSigningInMessage();
                    mode = MainGameScreenMode.SigningIn;
                }
                break;

            case MainGameScreenMode.SigningIn:
                if (signInTask.IsCompleted)
                {
                    signingInScreen.ExitScreen();

                    if (signInTask.Result)
                    {
                        // sign-in successful
                        mode = MainGameScreenMode.Closed;
                    }
                    else
                    {
                        // sign-in failure
                        mode = MainGameScreenMode.HandleSignInFailure;
                    }
                    signInTask = null;
                }
                break;

            case MainGameScreenMode.HandleSignInFailure:
//                    if (!Guide.IsVisible)
//                    {
                ShowSignInWarning();
                mode = MainGameScreenMode.Closed;
//                    }

                break;

            case MainGameScreenMode.ShowSignedOutMessage:
                //#if XBOX
                //                    if (!Guide.IsVisible)
                //#endif
                ShowSignOutWarning();
                mode = MainGameScreenMode.Closed;
//                    signInTask = null;
//                    }
                break;

/*
 *              case MainGameScreenMode.HandleSignedOutResult:
 *                  if (signedOutResult.IsCompleted)
 *                  {
 *                      mode = MainGameScreenMode.ResetGame;
 *                  }
 *                  break;
 */



            case MainGameScreenMode.ResetGame:
                InputManager.Initialize();
                InputManager.ClearPlayerIndex();
                StorageManager.Instance.Reset();
                endSession();

                ScreenManager.AddScreen(new SplashScreen(false));

                slotPanel.Reset();
                AudioManager.StopMusic();

                doorRightPosition       = new Vector2(ANCHOR_DOORCLOSED_RIGHT_X, 0);
                doorRightShadowPosition = new Vector2(ANCHOR_DOORSHADOWCLOSED_RIGHT_X, 0);
                doorLeftPosition        = Vector2.Zero;
                doorLeftShadowPosition  = Vector2.Zero;

                helpPanel.Off(false);

                mode = MainGameScreenMode.Closed;

                break;

            case MainGameScreenMode.Open:
                break;

            case MainGameScreenMode.Closed:
                if (!isStorageMessageDisplayed && IsActive && StorageManager.Instance.IsFirstPassDone)
                {
                    ShowStorageWarning(StorageDeviceWarningType.AutoSaveWarn);
                }
                break;

            case MainGameScreenMode.DelayOpening:
                openingDelayTimer += (float)gameTime.ElapsedGameTime.TotalSeconds;
                if (openingDelayTimer >= OPENING_DELAY_MAX)
                {
                    openingDelayTimer = 0;
                    mode = MainGameScreenMode.Opening;
                    slotPanel.Open();
                }
                break;

            case MainGameScreenMode.Opening:
                if (StorageManager.Instance.IsRefreshRequired)
                {
                    StorageManager.Instance.RefreshSaveGameDescriptions();
                    StorageManager.Instance.IsRefreshRequired = false;
                }

                doorRightPosition.X       += DEFAULT_DOORSPEED_RIGHT;
                doorRightShadowPosition.X += DEFAULT_DOORSPEED_RIGHT;
                doorLeftPosition.X        -= DEFAULT_DOORSPEED_LEFT;
                doorLeftShadowPosition.X  -= DEFAULT_DOORSPEED_LEFT;

                if (doorRightPosition.X >= ANCHOR_DOOROPEN_RIGHT_X)
                {
                    doorRightPosition.X = ANCHOR_DOOROPEN_RIGHT_X;
                }
                if (doorLeftPosition.X <= ANCHOR_DOOROPEN_LEFT_X)
                {
                    doorLeftPosition.X = ANCHOR_DOOROPEN_LEFT_X;
                }
                if (doorLeftPosition.X == ANCHOR_DOOROPEN_LEFT_X &&
                    doorRightPosition.X == ANCHOR_DOOROPEN_RIGHT_X)
                {
                    mode = MainGameScreenMode.SlotPanel;
                }
                break;

            case MainGameScreenMode.SlotPanel:
                if (isReadyToLoad)
                {
                    isLoadConfirmed = false;

                    AudioManager.PopMusic();

                    stopCogs(true);
                    resetTexture();

                    mode        = MainGameScreenMode.Loading;
                    loadingMode = LoadingMode.Starting;
                }
                break;

            case MainGameScreenMode.PickerPanel:
                if (isReadyForPuzzle)
                {
                    PuzzleEngine.SetPuzzle();

                    mode = MainGameScreenMode.PuzzlePanel;
                    puzzlePanel.Open();
                    isReadyForPuzzle = false;
                }
                break;

            case MainGameScreenMode.PuzzlePanel:
                if (isBackToPicker)
                {
                    mode = MainGameScreenMode.PickerPanel;
                    pickerPanel.Open();
                    isBackToPicker = false;
                }
                break;

            case MainGameScreenMode.CreditsPanel:

                break;

            case MainGameScreenMode.Closing:
                doorRightPosition.X       -= DEFAULT_DOORSPEED_RIGHT;
                doorRightShadowPosition.X -= DEFAULT_DOORSPEED_RIGHT;
                doorLeftPosition.X        += DEFAULT_DOORSPEED_LEFT;
                doorLeftShadowPosition.X  += DEFAULT_DOORSPEED_LEFT;

                if (doorRightPosition.X <= ANCHOR_DOORCLOSED_RIGHT_X)
                {
                    doorRightPosition.X = ANCHOR_DOORCLOSED_RIGHT_X;
                }
                if (doorLeftPosition.X >= ANCHOR_DOORCLOSED_LEFT_X)
                {
                    doorLeftPosition.X = ANCHOR_DOORCLOSED_LEFT_X;
                }
                if (doorLeftPosition.X == ANCHOR_DOORCLOSED_LEFT_X &&
                    doorRightPosition.X == ANCHOR_DOORCLOSED_RIGHT_X)
                {
                    mode = MainGameScreenMode.Closed;

                    AudioManager.PopMusic();

                    endSession();
                }
                break;

            case MainGameScreenMode.Exiting:
                if (ScreenState == ScreenState.FinishedExiting)
                {
                    ScreenManager.Game.Exit();
                }
                break;

            case MainGameScreenMode.Loading:
                switch (loadingMode)
                {
                case LoadingMode.Starting:
                    loadingAlpha += LOAD_ALPHA_STEP;
                    if (loadingAlpha >= 1)
                    {
                        loadingMode  = LoadingMode.Processing;
                        loadingAlpha = 1;
                    }
                    break;

                case LoadingMode.Finishing:
                    loadingPauseTimer += (float)gameTime.ElapsedGameTime.TotalSeconds;

                    if (loadingPauseTimer >= LOADING_PAUSE_LIMIT)
                    {
                        loadingAlpha -= LOAD_ALPHA_STEP;
                        if (loadingAlpha <= 0)
                        {
                            loadingPauseTimer = 0;

                            loadingAlpha = 0;
                            startCogs(true);

                            AudioManager.PlayMusic("bgCogsTurning");

                            loadingMode = LoadingMode.Finished;
                        }
                    }
                    break;

                case LoadingMode.Finished:
                    mode = MainGameScreenMode.PickerPanel;
                    pickerPanel.Open();
                    break;

                case LoadingMode.Processing:
                    // load new or saved game
                    if (isNewGame)
                    {
                        GameStartDescription gsd = ScreenManager.GlobalContent.Load <GameStartDescription>("NewGameDescription");
                        gsd.SaveSlotNumber = slotPanel.CurrentSlot.SlotNumber;
                        pickerPanel        = new PickerPanel(this, gsd);
                        puzzlePanel        = new PuzzlePanel(this);
                        pickerPanel.LoadContent(ScreenManager.SessionContent);
                        puzzlePanel.LoadContent(ScreenManager.SessionContent);

                        Session.QuickSave();

                        LoadProcessingComplete();
                    }
                    else if (!isLoadProcessingFirstPassDone)
                    {
                        pickerPanel = new PickerPanel(this, slotPanel.CurrentSlot.SaveGameDescription);
                        puzzlePanel = new PuzzlePanel(this);
                        pickerPanel.LoadContent(ScreenManager.SessionContent);
                        puzzlePanel.LoadContent(ScreenManager.SessionContent);
                        isLoadProcessingFirstPassDone = true;
                    }

                    break;
                }
                break;

            case MainGameScreenMode.Paused:

                switch (pauseMode)
                {
                case PauseMode.Waiting:
                    break;

                case PauseMode.Starting:
                    pauseAlpha += PAUSE_ALPHA_STEP;
                    if (pauseAlpha >= 1)
                    {
                        pauseMode  = PauseMode.Paused;
                        pauseAlpha = 1;
                    }
                    break;

                case PauseMode.Paused:
                    break;

                case PauseMode.Stopping:
                    pauseAlpha -= PAUSE_ALPHA_STEP;
                    if (pauseAlpha <= 0)
                    {
                        pauseMode = PauseMode.Waiting;
                        mode      = MainGameScreenMode.PuzzlePanel;
                        startCogs(true);

                        AudioManager.PlayMusic("bgCogsTurning");

                        puzzlePanel.startCogs();
                        PuzzleEngine.IsTimerDisabled = false;
                        pauseAlpha = 0;

                        IsPaused = false;
                    }
                    break;
                }
                break;
            }

            if (mode != MainGameScreenMode.Closed && mode != MainGameScreenMode.Exiting)
            {
                if (helpPanel != null)
                {
                    helpPanel.Update(gameTime);
                }
                if (slotPanel != null)
                {
                    slotPanel.Update(gameTime);
                }
                if (pickerPanel != null)
                {
                    pickerPanel.Update(gameTime);
                }
                if (puzzlePanel != null)
                {
                    puzzlePanel.Update(gameTime);
                }
                if (creditsPanel != null)
                {
                    creditsPanel.Update(gameTime);
                }
            }

            if (cogSpritesList != null)
            {
                foreach (BackgroundCogSprite cog in cogSpritesList)
                {
                    cog.Update(gameTime);
                }
            }
        }
Example #23
0
 public void RemoveAll(E_BlockType blockType, PuzzlePanel.BlockRemoveHandler handler)
 {
     sequence.blocks.ForAll(
         delegate(int x, int y, ref Block cell, ref bool stop)
         {
             if (cell != null && cell.blockType == blockType)
             {
                 if (handler != null)
                 {
                     handler(blockType, x, y);
                 }
                 cell.Destroy();
                 cell = null;
             }
         }
     );
     fsm.Event("RemoveBlock");
 }
Example #24
0
        public void TestNumber()
        {
            var p = new PuzzlePanel(1);

            Assert.AreEqual(1, p.Number);
        }
Example #25
0
    static HeroCharacter CreateCharacter(CharacterSelect characterSelect, InGameUser user, PuzzlePanel puzzlePanel, ItemDropManager itemDropManager, System.Action<StatusEffectEntity> addBuffIcon, System.Action<StatusEffectEntity> removeBuffIcon)
    {
        ItemHeroEntity heroEntity = TableLoader.GetTable<ItemHeroEntity>().Get(characterSelect.heroId);
        ObjectField objectField = TableLoader.GetTable<ObjectField>().Get(heroEntity.FieldObject);
        ItemHeroLevel heroLevelEntity = TableLoader.GetTable<ItemHeroLevel>().Get(heroEntity.HeroType, characterSelect.heroLevel);

        Buff.Handle onBuff = delegate(Buff buff)
        {
            if (addBuffIcon != null)
            {
                addBuffIcon(buff.statusEffectEntity);
            }
        };
        Buff.Handle onDeBuff = delegate(Buff buff)
        {
            if (removeBuffIcon != null)
            {
                removeBuffIcon(buff.statusEffectEntity);
            }
        };
        HeroCharacter heroCharacter = new HeroCharacter(objectField, heroEntity, heroLevelEntity, characterSelect.equipIds, false, user, puzzlePanel, onBuff, onDeBuff);

        {
            Action action = ActionPattern.Create("Vector(Self; [WalkSpeed]; 0; 0; false)").Generate(heroCharacter.Stat);
            heroCharacter.Fire(action, null);
            heroCharacter.PauseMoving();
        }

        for (int i = 0; i < 4; i++)
        {
            heroCharacter.AddItemSlot(i, user.commandQueue);
        }

        {
            heroCharacter.AddAction(Action.E_Type.Money,
                delegate(float value, GameInstance firer, string[] param)
                {
                    Action action = ActionPattern.Create("Action(User; Money; {0})").Generate(heroCharacter.Stat, value);
                    if (action != null)
                    {
                        heroCharacter.Fire(action, null);
                    }
                    return null;
                }
            );
            heroCharacter.AddAction(Action.E_Type.Exp,
                delegate(float value, GameInstance firer, string[] param)
                {
                    Action action = ActionPattern.Create("Action(User; Exp; {0})").Generate(heroCharacter.Stat, value);
                    if (action != null)
                    {
                        heroCharacter.Fire(action, null);
                    }
                    return null;
                }
            );
            heroCharacter.AddAction(Action.E_Type.GetKey,
                delegate(float value, GameInstance firer, string[] param)
                {
                    Action action = ActionPattern.Create("Action(User; GetKey; {0})").Generate(heroCharacter.Stat, value);
                    if (action != null)
                    {
                        heroCharacter.Fire(action, null);
                    }
                    return null;
                }
            );
            heroCharacter.AddAction(Action.E_Type.GetConsumable,
                delegate(float value, GameInstance firer, string[] param)
                {
                    if (RandomTool.IsIn(value))
                    {
                        var itemCommand = itemDropManager.DropItem();
                        if (itemCommand != null)
                        {
                            heroCharacter.TryAddItem(itemCommand);
                        }
                    }
                    return null;
                }
            );
        }

        return heroCharacter;
    }