Ejemplo n.º 1
0
    public MenuInGame(FSM parentFsm, UIManager2 panel1, UIManager2 panel2)
        : base(parentFsm, panel1, panel2, "MenuInGame.fsm")
    {
        timeClient = TimeManager.Instance.Create();

        InitUI();

        int stageId = (int)parentFsm.Variables["stageId"];

        /*
        // ddong
        if (stageId < 2000)
        {
            stageId += 2000;
        }
        */

        InitStage(stageId, out stageEntity, out gameEntity);

        Rect fieldArea = UI.GetFieldArea();
        field = CreateField(stageEntity, fieldArea, timeClient, fsm);

        // ddong
        int subClassCode = 11;
        int level = 1;
        int trainLevel = 1;

        this.subClassEntity = TableLoader.GetTable<SubClassEntity>().Get(subClassCode);
        ClassLevelEntity levelEntity = TableLoader.GetTable<ClassLevelEntity>().Get(subClassEntity.classCode, level);
        TrainLevelEntity trainLevelEntity = TableLoader.GetTable<TrainLevelEntity>().Get(subClassEntity.classCode, trainLevel);
        FieldObjectEntity objectField = TableLoader.GetTable<FieldObjectEntity>().Get(subClassEntity.objectCode);

        Rect puzzleArea = UI.GetPuzzleArea();
        CreatePuzzle(puzzleArea, timeClient, subClassCode, out puzzleRecord, out puzzlePanel);

        user = CreateUser(stageEntity, UI, fsm);
        heroCharacter = CreateCharacter(objectField, levelEntity, trainLevelEntity, subClassEntity, user, puzzlePanel, itemDropManager, UI.AddBuffIcon, UI.RemoveBuffIcon, fsm);
        itemDropManager = new ConsumableSpawn(stageEntity.gameModeCode, levelEntity.consumableTier);

        Func<float> getLifeDrainRate = (() => gameEntity.defaultHP);
        new PlayerCharacter(user, heroCharacter, getLifeDrainRate, fsm);
        /*
        heroCharacter.Status.RegisterOnChangeEvent(HeroCharacter.Character.HP, OnCharacterHPChanged);
        heroCharacter.Status.RegisterOnChangeEvent(HeroCharacter.Character.HP, UI.ChangeHP);
        heroCharacter.Status.RegisterOnChangeEvent(HeroCharacter.Character.MP, UI.ChangeMana);
        heroCharacter.Status.RegisterOnChangeEvent(HeroCharacter.Character.Armor, UI.ChangeShield);
        */

        UI.InitCommendSlots(fsm, heroCharacter);

        field.AddPlayerCharacter(heroCharacter);
        field.FocusOnForced(heroCharacter, 0);
        puzzlePanel.SetQueue(user.commandQueue);

        var screenPosTable = TableLoader.GetTable<ScreenPositionEntity2>();
        var hpToPos = screenPosTable.Values.Select(x => new KeyValuePair<float, float>(x.hp, x.screenPos));
        convertHPRatioToScreenPos = new RangeConvertor(hpToPos).Convert;

        SetFocusTarget(heroCharacter);
    }
Ejemplo n.º 2
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);
 }
Ejemplo n.º 3
0
        public async Task GetTime_response_is_not_null()
        {
            using (var api = new GdaxApiClient(FakeCredentials, sandbox: true))
            {
                var timeClient = new TimeClient(api);

                var result = await timeClient.GetTime().SendAsync().ConfigureAwait(false);

                Assert.NotNull(result);
            }
        }
Ejemplo n.º 4
0
    public MenuInGame(FSM parentFsm, UIManager2 panel1, UIManager2 panel2)
        : base(parentFsm, panel1, panel2, "MenuInGame.fsm")
    {
        timeClient = TimeManager.Instance.Create();

        InitUI();

        int stageId = (int)parentFsm.Variables["stageId"];
        InitStage(stageId, out stageEntity, out gameEntity);

        Rect fieldArea = UI.GetFieldArea();
        itemDropManager = new ItemDropManager(stageEntity.GameModeType, stageEntity.ConsumableTier);
        field = CreateField(stageEntity, fieldArea, timeClient, itemDropManager, fsm);

        // ddong
        CharacterSelect characterSelect = new CharacterSelect()
        {
            heroLevel = SaveData.level,
            heroId = GetClassCode(SaveData.selectClass),
            equipIds = ArrayTool.Create<int>(),
        };
        this.heroEntity = TableLoader.GetTable<ItemHeroEntity>().Get(characterSelect.heroId);

        Rect puzzleArea = UI.GetPuzzleArea();
        CreatePuzzle(stageEntity, heroEntity.HeroType, puzzleArea, timeClient, out puzzleRecord, out puzzlePanel);

        user = CreateUser(stageEntity, UI, fsm);
        heroCharacter = CreateCharacter(characterSelect, user, puzzlePanel, itemDropManager, UI.AddBuffIcon, UI.RemoveBuffIcon);
        user.SetCharacter(heroCharacter);
        puzzlePanel.SetOwner(heroCharacter);

        Func<float> getLifeDrainRate = (() => gameEntity.DefaultLifeDrainRate + gameEntity.LifeDrainRateIncrease * timeClient.time);
        new PlayerCharacter(user, heroCharacter, getLifeDrainRate, fsm);
        heroCharacter.Status.RegisterOnChangeEvent(HeroCharacter.Character.HP, OnCharacterHPChanged);
        heroCharacter.Status.RegisterOnChangeEvent(HeroCharacter.Character.HP, UI.ChangeHP);
        heroCharacter.Status.RegisterOnChangeEvent(HeroCharacter.Character.MP, UI.ChangeMana);
        heroCharacter.Status.RegisterOnChangeEvent(HeroCharacter.Character.Armor, UI.ChangeShield);

        UI.InitCommendSlots(fsm, heroCharacter);

        field.AddPlayerCharacter(heroCharacter);
        field.FocusOnForced(heroCharacter, 0);
        puzzlePanel.SetQueue(user.commandQueue);

        SetFocusTarget(heroCharacter);

        // ddong
        CutInStarter = StartCutIn;
    }
Ejemplo n.º 5
0
    public PuzzlePanel(Rect rect, int subClassCode, PuzzleRecord record, TimeClient timeClient)
    {
        this.timeClient = timeClient;
        this.record = record;

        if (box == null)
        {
            Rect captureRect = new Rect(1000, 1000, PuzzleOption.BlockCountX, PuzzleOption.BlockCountY);
            box = new CameraBox("PuzzleCamera", captureRect, rect, -1, 2, 2, null, CullingLayer, timeClient);
            box.GetLayer(1).coord.SetScale(new Vector3(1, -1, 1));
            box.GetLayer(1).coord.Move(new Vector2(-(PuzzleOption.BlockCountX - 1) / 2f, (PuzzleOption.BlockCountY - 1) / 2f));
        }

        board = new Board(rect, this, BlockSpawn.GetDart(subClassCode), false, OnMatching, OnMatchStart, OnMatchFinish, timeClient);
    }
Ejemplo n.º 6
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();
        }
    }
Ejemplo n.º 7
0
 public TestingClients(string ledgerId, Channel channel, string accessToken)
 {
     TimeClient  = new TimeClient(ledgerId, channel, accessToken);
     ResetClient = new ResetClient(ledgerId, channel, accessToken);
 }
Ejemplo n.º 8
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);
 }
Ejemplo n.º 9
0
    static Field CreateField(StageEntity2 stageEntity, Rect fieldArea, TimeClient timeClient, FSM fsm)
    {
        //PreloadTool.PreloadStage(stageEntity.stageCode);

        Field field = new Field(fieldArea, timeClient);
        //field.ChangeSceneary(stageEntity.resource);
        field.AddObstacles(StageSpawn.SpawnWithPos(stageEntity.stageCode), fsm);
        return field;
    }
Ejemplo n.º 10
0
    public CameraBox(string cameraName, Rect worldClipping, Rect viewPort, float minDepth, float maxDepth, float cameraDepth, Color? bgColor, int cullingLayer, TimeClient timeClient)
    {
        rawCamera = new GameObject(cameraName, typeof(Camera)).GetComponent<Camera>();
        rawCamera.gameObject.layer = cullingLayer;
        rawCamera.orthographic = true;
        rawCamera.cullingMask = 1 << cullingLayer;

        if (bgColor == null)
        {
            rawCamera.clearFlags = CameraClearFlags.Depth;
        }
        else
        {
            rawCamera.backgroundColor = bgColor.Value;
        }
        rawCamera.depth = cameraDepth;

        this.minDepth = minDepth;
        this.maxDepth = maxDepth;
        // Assign viewPort first
        this.viewPort = viewPort;
        this.worldClipping = worldClipping;

        this.timeClient = timeClient;
        layers = new Dictionary<int, Layer>();
    }
Ejemplo n.º 11
0
    public PuzzlePanel(Rect rect, E_HeroType heroType, E_GameModeType gameModeType, PuzzleRecord record, TimeClient timeClient)
    {
        this.timeClient = timeClient;
        this.record = record;

        if (box == null)
        {
            Rect captureRect = new Rect(1000, 1000, PuzzleOption.BlockCountX, PuzzleOption.BlockCountY);
            box = new CameraBox("PuzzleCamera", captureRect, rect, -1, 2, 2, null, CullingLayer, timeClient);
            box.GetLayer(1).coord.SetScale(new Vector3(1, -1, 1));
            box.GetLayer(1).coord.Move(new Vector2(-(PuzzleOption.BlockCountX - 1) / 2f, (PuzzleOption.BlockCountY - 1) / 2f));

            //feverGuageBack
            {
                int layer = LayerMask.NameToLayer("Field");
                camera2 = new CameraBox("PuzzleCamera2", captureRect, rect, -1, 2, 1, null, layer, timeClient);
                feverGuageBack = GameObject.Instantiate(Resources.Load("vfx50021_GUI_Summongauge01")) as GameObject;
                feverGuageBack.transform.parent = camera2.transform;
                GameObjectTool.SetLayerRecursively(feverGuageBack.transform, layer);
                SetFeverGuageRatio(0f);
            }
        }

        board = new Board(rect, this, heroType, OnMatching, OnMatchStart, OnMatchFinish, timeClient);

        AddAction(Action.E_Type.Transform_Attack1,
            delegate(float value, GameInstance firer, string[] param)
            {
                board.ChangeBlock(ArrayTool.Create(E_BlockType.Item, E_BlockType.Gather), E_BlockType.Attack1, OnChangeBlock);
                return new ActionHandler.Result(null, value);
            }
        );
        AddAction(Action.E_Type.Transform_Attack2,
            delegate(float value, GameInstance firer, string[] param)
            {
                board.ChangeBlock(ArrayTool.Create(E_BlockType.Item, E_BlockType.Gather), E_BlockType.Attack2, OnChangeBlock);
                return new ActionHandler.Result(null, value);
            }
        );
        AddAction(Action.E_Type.Remove_Ability,
            delegate(float value, GameInstance firer, string[] param)
            {
                board.RemoveAll(E_BlockType.Ability, OnRemoveBlock);
                return new ActionHandler.Result(null, value);
            }
        );
        AddAction(Action.E_Type.Remove_Defend,
            delegate(float value, GameInstance firer, string[] param)
            {
                board.RemoveAll(E_BlockType.Defend, OnRemoveBlock);
                return new ActionHandler.Result(null, value);
            }
        );
        AddAction(Action.E_Type.Remove_Item,
            delegate(float value, GameInstance firer, string[] param)
            {
                board.RemoveAll(E_BlockType.Item, OnRemoveBlock);
                return new ActionHandler.Result(null, value);
            }
        );
        AddAction(Action.E_Type.Remove_Gather,
            delegate(float value, GameInstance firer, string[] param)
            {
                board.RemoveAll(E_BlockType.Gather, OnRemoveBlock);
                return new ActionHandler.Result(null, value);
            }
        );

        /*
        Stat<BlockSpawn> stat = StatLoader.Instance.GetStatTable<E_GameModeType, BlockSpawn>("GameModeType").Get(gameModeType);
        status = new Status(null, stat, null);
        AddAction(Action.E_Type.Buff,
            delegate(float value, GameInstance firer, string[] param)
            {
                Buff.Handle onBuff = null;
                Buff.Handle onDebuff = null;
                int? buffID = Cast.To<int>(value);
                status.AddBuff(buffID.Value, firer.Stat, onBuff, onDebuff);
                return new ActionHandler.Result(null, value);
            }
        );
        AddAction(Action.E_Type.Shuffle,
            delegate(float value, GameInstance firer, string[] param)
            {
                board.Shuffle();
                return new ActionHandler.Result(null, value);
            }
        );
         * */
    }
Ejemplo n.º 12
0
 public Field(Rect fieldArea, TimeClient timeClient)
 {
     Rect viewPortRect = fieldArea;
     Rect captureRect = new Rect(1000, 0, CaptureWidth, CaptureWidth * viewPortRect.height / viewPortRect.width);
     box = new CameraBox("FieldCamera", captureRect, viewPortRect, MinDepth, MaxDepth, -1, Color.black, LayerMask.NameToLayer("Field"), timeClient);
 }
Ejemplo n.º 13
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);
 }
Ejemplo n.º 14
0
    static Field CreateField(StageEntity stageEntity, Rect fieldArea, TimeClient timeClient, ItemDropManager itemDropManager, FSM fsm)
    {
        //PreloadTool.PreloadStage(stageEntity.StageID);

        Field field = new Field(fieldArea, timeClient);
        field.ChangeSceneary(stageEntity.Resource);
        field.AddObstacles(StageSpawn.SpawnWithPos(stageEntity.StageID), itemDropManager, fsm);
        return field;
    }