Example #1
0
 public bool SavePuzzleRating(PuzzleRecord record)
 {
     lock (locker)
     {
         PuzzleRecord old = dbConnection.Table <PuzzleRecord>().FirstOrDefault();
         if (old == null)
         {
             dbConnection.Insert(record);
             return(true);
         }
         else
         {
             if (record.GameTime < old.GameTime)
             {
                 record.PuzzlePlayerRatingId = old.PuzzlePlayerRatingId;
                 dbConnection.Update(record, typeof(PuzzleRecord));
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
     }
 }
        public void SaveResult()
        {
            Timer.Stop();
            PuzzleRecord record = new PuzzleRecord
            {
                GameTime     = Timer.ElapsedMilliseconds,
                LastModified = DateTime.UtcNow
            };

            App.Rest.UpdatePuzzle(record);
        }
Example #3
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);
    }
Example #4
0
        public async void UpdatePuzzle(PuzzleRecord record)
        {
            bool needsUpdate = Db.SavePuzzleRating(record);

            if (needsUpdate)
            {
                object toSend = new
                {
                    PuzzlePlayerRatingId = 0,
                    GameTime             = record.GameTime,
                    LastModified         = record.LastModified,
                    PlayerId             = Db.GetUser().ReturnableUser
                };
                string              jsonContent = JsonConvert.SerializeObject(toSend);
                StringContent       data        = new StringContent(jsonContent, Encoding.UTF8, "application/json");
                HttpResponseMessage response    = await client.PostAsync(puzzleRecordUrl, data);
            }
        }
Example #5
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 #6
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);
            }
        );
         * */
    }
Example #7
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);
 }