예제 #1
0
 public SeasonDetailVM()
 {
     seasonApi     = new Api.SeasonApi();
     PlayerAPI     = new PlayerAPI();
     followAPI     = new Api.User.FollowAPI();
     FollowCommand = new RelayCommand(DoFollow);
 }
예제 #2
0
        //public abstract List<TileAPI> getPossibleMoves();
        public bool hasEnemyUnits()
        {
            PlayerAPI      enemy = (this.getPlayer() == Game.INSTANCE.player1) ? Game.INSTANCE.player2 : Game.INSTANCE.player1;
            List <UnitAPI> l     = Game.INSTANCE.getUnits(this.x, this.y, enemy);

            return(l.Count() > 0);
        }
예제 #3
0
        public List <UnitAPI> getUnits(int x, int y, PlayerAPI enemy = null)
        {
            List <UnitAPI> list = new List <UnitAPI>();

            if (enemy != Game.INSTANCE.player1)
            {
                for (int i = 0; i < this.player2.units.Count; i++)
                {
                    if (this.player2.units[i].x == x && this.player2.units[i].y == y)
                    {
                        list.Add(this.player2.units[i]);
                    }
                }
            }
            if (enemy != Game.INSTANCE.player2)
            {
                for (int i = 0; i < this.player1.units.Count; i++)
                {
                    if (this.player1.units[i].x == x && this.player1.units[i].y == y)
                    {
                        list.Add(this.player1.units[i]);
                    }
                }
            }
            return(list);
        }
예제 #4
0
        private void placeUnits(MapAPI map, PlayerAPI player, int nb_units, int[] posUnits)
        {
            UnitAPI unit;

            for (int i = 0; i < nb_units; i++)
            {
                Race race = player.race;
                switch (race)
                {
                case Race.Human:
                    unit = new Human(posUnits[0], posUnits[1]);
                    break;

                case Race.Elf:
                    unit = new Elf(posUnits[0], posUnits[1]);
                    break;

                case Race.Orc:
                    unit = new Orc(posUnits[0], posUnits[1]);
                    break;

                default:
                    throw new ArgumentException();
                }
                player.units.Add(unit);
            }
        }
예제 #5
0
        /*
         * Create a map using the C++ library
         */

        public int[] getMoves(MapStrategy strategy, UnitAPI unit, PlayerAPI p1, PlayerAPI p2, int curr_p, GameAPI game)
        {
            int[] curr_pos = { unit.x, unit.y };
            Race  race     = (curr_p == 1) ? p1.race : p2.race;

            int[]      moves = new int[strategy.size * strategy.size];
            TileType[] tiles = new TileType[strategy.size * strategy.size];
            int[]      pos   = new int[strategy.size * strategy.size];


            foreach (var tmpUnit in p1.units)
            {
                pos[tmpUnit.y * strategy.size + tmpUnit.x] = 1;
            }
            foreach (var tmpUnit in p1.units)
            {
                pos[tmpUnit.y * strategy.size + tmpUnit.x] = 2;
            }


            for (int i = 0; i < strategy.size; i++)
            {
                for (int j = 0; j < strategy.size; j++)
                {
                    tiles[i + strategy.size * j] = game.map.tiles[i, j].getType();
                }
            }

            Algo_getMoves(nativeAlgo, tiles, strategy.size, pos, curr_pos, curr_p, race, moves);
            return(moves);
        }
예제 #6
0
    public async Task <PlayerAPI> GetPlayer(string playerId)
    {
        string response = await GetRequest("/players/" + playerId);

        PlayerAPI player = JsonConvert.DeserializeObject <PlayerAPI>(response);

        return(player);
    }
 public SendDanmakuDialog(string _aid, string _cid, double _position)
 {
     this.InitializeComponent();
     playerAPI = new PlayerAPI();
     cid       = _cid;
     aid       = _aid;
     position  = Convert.ToInt32(_position);
 }
예제 #8
0
    protected override void OnExecute()
    {
        PlayerAPI api = agent.transform.GetComponent <PlayerAPI>();

        api.InitAPI();
        childCubes.value = api.GetChildPlayCubes();
        EndAction(true);
    }
예제 #9
0
    protected override void OnExecute()
    {
        PlayerAPI playerApi = player.value.GetComponent <PlayerAPI>();

        playerApi.Dead();
        StartCoroutine(RestartLevel());
        EndAction(true);
    }
예제 #10
0
 protected override string OnInit()
 {
     if (player.value != null) {
         api = player.value.GetComponent<PlayerAPI>();
     } else {
         api = agent.transform.GetComponent<PlayerAPI>();
     }
     return null;
 }
예제 #11
0
 protected override string OnInit()
 {
     if (player.value != null)
     {
         api = player.value.GetComponent <PlayerAPI>();
     }
     else
     {
         api = agent.transform.GetComponent <PlayerAPI>();
     }
     return(null);
 }
예제 #12
0
 public static void command_listPlayers()
 {
     ColourEngine.writeLine("----------------------------------------", ConsoleColor.Cyan, Console.BackgroundColor);
     ColourEngine.writeLine("             [PLAYERS ONLINE]           ", ConsoleColor.Cyan, Console.BackgroundColor);
     ColourEngine.writeLine("----------------------------------------", ConsoleColor.Cyan, Console.BackgroundColor);
     ColourEngine.writeLine("                                        ", ConsoleColor.Cyan, Console.BackgroundColor);
     foreach (Player Player in PlayerAPI.getPlayers())
     {
         ColourEngine.writeLine("  " + Player.playerName + " Ping: " + Player.Ping.ToString() + " Bal: $" + BalanceAPI.getBalance(Player).ToString() + " IP: " + Player.IP + " UID: " + Player.UID.ToString(), ConsoleColor.Yellow, Console.BackgroundColor);
     }
     ColourEngine.writeLine("                                        ", ConsoleColor.Cyan, Console.BackgroundColor);
     ColourEngine.writeLine("----------------------------------------", ConsoleColor.Cyan, Console.BackgroundColor);
 }
예제 #13
0
        internal static void InitializeHooks()
        {
            On.RoR2.RoR2Application.UnitySystemConsoleRedirector.Redirect += orig => { };

            SurvivorAPI.InitHooks();
            AssetAPI.InitHooks();
            ItemDropAPI.InitHooks();
            InventoryAPI.InitHooks();
            EntityAPI.InitHooks();
            LobbyConfigAPI.InitHooks();
            PlayerAPI.InitHooks();
            ConsoleAPI.InitHooks();
        }
예제 #14
0
 public SettingVM()
 {
     playerAPI   = new PlayerAPI();
     ThemeColors = new List <AppThemeColor>()
     {
         new AppThemeColor()
         {
             use_system_color = true,
             name             = "跟随系统"
         },
         new AppThemeColor()
         {
             color = "#FFDF85A0",
             name  = "少女粉",
             theme = "Pink",
         },
         new AppThemeColor()
         {
             color = "#FFF70D0D",
             name  = "姨妈红",
             theme = "Red",
         },
         new AppThemeColor()
         {
             color = "#FFF9EF23",
             name  = "咸蛋黄",
             theme = "Yellow",
         },
         new AppThemeColor()
         {
             color = "#FF71F923",
             name  = "早苗绿",
             theme = "Green",
         },
         new AppThemeColor()
         {
             color = "#FF18BDFB",
             name  = "胖次蓝",
             theme = "Blue",
         },
         new AppThemeColor()
         {
             color = "#FFB92CBF",
             name  = "基佬紫",
             theme = "Purple",
         }
     };
     LoadShieldSetting();
 }
예제 #15
0
 public VideoDetailVM()
 {
     videoAPI         = new VideoAPI();
     favoriteAPI      = new Api.User.FavoriteApi();
     PlayerAPI        = new PlayerAPI();
     followAPI        = new Api.User.FollowAPI();
     RefreshCommand   = new RelayCommand(Refresh);
     LikeCommand      = new RelayCommand(DoLike);
     DislikeCommand   = new RelayCommand(DoDislike);
     LaunchUrlCommand = new RelayCommand <object>(LaunchUrl);
     CoinCommand      = new RelayCommand <string>(DoCoin);
     //FavoriteCommand = new RelayCommand<string>(DoFavorite);
     AttentionCommand      = new RelayCommand(DoAttentionUP);
     SetStaffHeightCommand = new RelayCommand <string>(SetStaffHeight);
 }
예제 #16
0
 public static void onServerJoinHandler(Player JoinedPlayer)
 {
     if (ConfigAPI.loadProfile(JoinedPlayer))
     {
         PlayerAPI.createPlayer(JoinedPlayer);
         ColourEngine.write("[Project Eco] ", ConsoleColor.Magenta, Console.BackgroundColor);
         ColourEngine.writeLine("Welcome " + JoinedPlayer.playerName + " to the server!", ConsoleColor.Red, Console.BackgroundColor);
     }
     else
     {
         ServerAPI.playerList.Add(JoinedPlayer);
         ColourEngine.write("[Project Eco] ", ConsoleColor.Magenta, Console.BackgroundColor);
         ColourEngine.writeLine(JoinedPlayer.playerName + " joined the server.", ConsoleColor.Yellow, Console.BackgroundColor);
     }
 }
예제 #17
0
 private void isFinished()
 {
     if (game.isFinished())
     {
         PlayerAPI player = game.getWinner();
         if (player == null)
         {
             MessageBox.Show("Nobody wins!");
         }
         else
         {
             MessageBox.Show(player.name + " wins!");
         }
         Views.GameWindow.goToStartup();
     }
 }
예제 #18
0
 public PlayerVM()
 {
     playUrlApi           = new gRPC.Api.PlayURL();
     PlayerAPI            = new PlayerAPI();
     DefaultDanmakuColors = new List <string>()
     {
         "#FE0302",
         "#FF7204",
         "#FFAA02",
         "#FFD302",
         "#FFFF00",
         "#A0EE00",
         "#00CD00",
         "#019899",
         "#4266BE",
         "#89D5FF",
         "#CC0273",
         "#222222",
         "#9B9B9B",
         "#FFFFFF"
     };
 }
예제 #19
0
    // Update is called once per frame

    public async void DisplayPlayerDescription()
    {
        Players.Clear();
        RoomAPI room = await MyDCDL_API_Handler.GetRoom(MyGameMode.CurrentRoom);

        foreach (string playerId in room.playerIds)
        {
            PlayerAPI player = await MyDCDL_API_Handler.GetPlayer(playerId);

            Players.Add(player);
            Dropdown.AddOptions(new List <string> {
                playerId
            });
        }

        if (room.playerIds.Count > 0)
        {
            Dropdown.value = 1;
            Dropdown.onValueChanged.Invoke(1);
            gameObject.GetComponent <Canvas>().enabled = true;
        }
    }
    public void Update()
    {
        orig_Update();

        if (Input.GetKeyDown(KeyCode.Backspace))
        {
            Managers.UIManager.ShowDevPanel(!Managers.UIManager.devPanel.activeSelf);
        }

        #region Control + ?  Binds
        if (Input.GetKey(KeyCode.RightControl) || Input.GetKey(KeyCode.LeftControl))
        {
            if (Input.GetKeyDown(KeyCode.F1) && Managers.CheckpointManager.checkpointsInScene.Count > 0)
            {
                this.dm_CheckpointIndex++;
                Player.Instance.transform.position = Managers.CheckpointManager.checkpointsInScene[this.dm_CheckpointIndex].transform.position;
                if (this.dm_CheckpointIndex >= Managers.CheckpointManager.checkpointsInScene.Count - 1)
                {
                    this.dm_CheckpointIndex = -1;
                }
            }

            if (Input.GetKeyDown(KeyCode.F2))
            {
                Player.Instance.transform.position = Managers.CheckpointManager.lastCheckpoint;
            }

            if (Input.GetKeyDown(KeyCode.F3))
            {
                PlayerAPI.SetCurrentPlayerHealth(9999);
                PlayerAPI.SetPlayerCanTakeDamage(true);
            }

            if (Input.GetKeyDown(KeyCode.F4))
            {
                this.dm_FastForwardToggle = !this.dm_FastForwardToggle;
                Time.timeScale            = this.dm_FastForwardToggle ? 5 : 1;
            }

            if (Input.GetKeyDown(KeyCode.F5))
            {
                this.dm_SpeedToggle = !this.dm_SpeedToggle;
                float speed = Player.Instance.Stats.DefaultMoveSpeed;
                PlayerAPI.SetMoveSpeed(this.dm_SpeedToggle ? speed * 2.2f : speed);
            }

            if (Input.GetKeyDown(KeyCode.F6))
            {
                if (this.dm_ThirdPersonToggle)
                {
                    this.dm_ThirdPersonToggle = false;
                    ThirdPersonAPI.DeactivateThirdPerson();
                }
                else
                {
                    this.dm_ThirdPersonToggle = true;
                    ThirdPersonAPI.ActivateThirdPerson();
                }
            }

            if (Input.GetKeyDown(KeyCode.F7))
            {
                this.dm_PowerToggle = !this.dm_PowerToggle;
                PlayerAPI.SetDamage(this.dm_PowerToggle ? 10 : 1);
            }

            if (Input.GetKeyDown(KeyCode.F8))
            {
                this.dm_HeartsToggle = !this.dm_HeartsToggle;
                Managers.UIManager.ToggleHearts(this.dm_HeartsToggle);
            }

            if (Input.GetKeyDown(KeyCode.F9) && Player.Instance != null)
            {
                if (this.dm_SwordToggle)
                {
                    PlayerAPI.DisableSword();
                    this.dm_SwordToggle = false;
                }
                else
                {
                    PlayerAPI.EnableSword();
                    this.dm_SwordToggle = true;
                }
            }
        }
        #endregion

        #region ALT + ? Binds
        if (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt))
        {
            if (Input.GetKeyDown(KeyCode.B))
            {
                this.dm_DrawingBoxColliders = !this.dm_DrawingBoxColliders;
                if (this.dm_DrawingBoxColliders)
                {
                    BoundsAPI.DrawBoxColliders(FindObjectsOfType <BoxCollider>());
                }
                else
                {
                    BoundsAPI.DestroyBounds(BoundsType.BOX_COLLIDER);
                }
            }

            if (Input.GetKeyDown(KeyCode.C))
            {
                this.dm_DrawingCapsuleColliders = !this.dm_DrawingCapsuleColliders;
                if (this.dm_DrawingCapsuleColliders)
                {
                    BoundsAPI.DrawCapsuleColliders(FindObjectsOfType <CapsuleCollider>());
                }
                else
                {
                    BoundsAPI.DestroyBounds(BoundsType.CAPSULE_COLLIDER);
                }
            }

            if (Input.GetKeyDown(KeyCode.S))
            {
                this.dm_DrawingSphereColliders = !this.dm_DrawingSphereColliders;
                if (this.dm_DrawingSphereColliders)
                {
                    BoundsAPI.DrawSphereColliders(FindObjectsOfType <SphereCollider>());
                }
                else
                {
                    BoundsAPI.DestroyBounds(BoundsType.SPHERE_COLLIDER);
                }
            }

            if (Input.GetKeyDown(KeyCode.M))
            {
                this.dm_DrawingMeshColliders = !this.dm_DrawingMeshColliders;
                if (this.dm_DrawingMeshColliders)
                {
                    BoundsAPI.DrawMeshColliders(FindObjectsOfType <MeshCollider>());
                }
                else
                {
                    BoundsAPI.DestroyBounds(BoundsType.MESH_COLLIDER);
                }
            }
        }
        #endregion
    }
예제 #21
0
 protected override string OnInit()
 {
     api1 = player1.value.GetComponent<PlayerAPI>();
     api2 = player2.value.GetComponent<PlayerAPI>();
     return null;
 }
예제 #22
0
 public PlayerVM(bool isDownload)
 {
     playUrlApi = new gRPC.Api.PlayURL();
     PlayerAPI  = new PlayerAPI();
     IsDownload = isDownload;
 }
예제 #23
0
 public InteractionVideoVM(string avid, int graph_version)
 {
     this.Aid          = avid;
     this.GraphVersion = graph_version;
     playerAPI         = new PlayerAPI();
 }
예제 #24
0
 protected override string OnInit()
 {
     api1 = player1.value.GetComponent <PlayerAPI>();
     api2 = player2.value.GetComponent <PlayerAPI>();
     return(null);
 }