예제 #1
0
    public void SendGameTip(string origin, string content)
    {
        Socket.SendMessage(new GameTipSentMessage(origin, content));
        PlayerInfoManager pim = FindObjectOfType <PlayerInfoManager>();

        pim.HighlightPlayer(this);
    }
예제 #2
0
 void CmdAdd()
 {
     infoManager          = FindObjectOfType <PlayerInfoManager> ();
     player               = infoManager.Register("Haha");
     this.gameObject.name = player.ToString();
     RpcAdd(player);
 }
예제 #3
0
        /// <summary>
        /// Покупка еды закусочной
        /// </summary>
        private void BuyBistroFood(Client player, object[] args)
        {
            var price      = (int)args[0];
            var playerInfo = PlayerInfoManager.GetInfo(player);

            if (playerInfo.Balance < price)
            {
                API.sendNotificationToPlayer(player, "~r~Недостаточно денег", true);
                return;
            }
            var satiety    = (int)args[1];
            var newSatiety = playerInfo.Satiety + satiety;

            playerInfo.Satiety  = newSatiety <= PlayerInfo.MAX_VALUE ? newSatiety : PlayerInfo.MAX_VALUE;
            playerInfo.Balance -= price;
            PlayerInfoManager.RefreshUI(player, playerInfo);
            var truckDriverName = args[2].ToString();

            if (!string.IsNullOrEmpty(truckDriverName))
            {
                _bistroManager.SetTruckDriverRevard(truckDriverName, price, playerInfo.Name);
            }
            API.sendNotificationToPlayer(player, $"Сытость восстановлена на ~b~{satiety} ед.");
            API.triggerClientEvent(player, ServerEvent.HIDE_BISTRO_FOOD_MENU);
            var street = (int)args[0];

            if (street != Validator.INVALID_ID)
            {
                _clanManager.ReplenishClanBalance(street, price);
            }
        }
예제 #4
0
    private void GameOver()
    {
        // Player Won the level
        if (IsLevelClear())
        {
            PlayerInfo playerInfo = PlayerInfoManager.GetCurrentPlayerInfo();

            TimeSpan time    = TimeSpan.FromSeconds(timer.totalTime);
            TimeSpan oldTime = playerInfo.Levels[levelIndex].time;

            //Actualizar récord si se ha batido o si no existia(oldTime == 0)
            if (time < oldTime || Math.Abs(oldTime.TotalSeconds) < float.Epsilon)
            {
                playerInfo.Levels[levelIndex].time = time;
            }

            // Desbloquear siguiente nivel si es necesario  si quedan niveles por desbloquear
            if ((levelIndex + 1) < GameManager.GetLevelsCount())
            {
                playerInfo.Levels[levelIndex + 1].unlocked = true;
            }
            PlayerInfoManager.SetCurrentPlayerInfo(playerInfo);
            GameManager.Save();
        }
        //Ir a la pantalla de selección de nivel
        GameManager.ChangeScene(Scene.SELECT_LEVEL);
    }
        /// <summary>
        /// Забрать машину со штрафстоянки
        /// </summary>
        private void GetVehicleFromParkingFine(Client player, object[] args)
        {
            var freePlace = GetFreePlace();

            if (freePlace == null)
            {
                API.sendNotificationToPlayer(player, "~r~В данный момент на стоянке нет свободных мест", true);
                return;
            }
            var price      = (int)args[1];
            var playerInfo = PlayerInfoManager.GetInfo(player);

            if (playerInfo.Balance < price)
            {
                API.sendNotificationToPlayer(player, "~r~Недостаточно средств", true);
                return;
            }
            playerInfo.Balance -= price;
            var vehicleInfo = JsonConvert.DeserializeObject <Vehicle>(args[0].ToString());

            vehicleInfo.IsSpawned     = true;
            vehicleInfo.OnParkingFine = false;
            _vehicleManager.CreateVehicle(vehicleInfo, freePlace.Item1, freePlace.Item2);
            _vehicleInfoManager.SetInfo(player, vehicleInfo);
            API.triggerClientEvent(player, ServerEvent.HIDE_PARKING_FINE_MENU);
        }
예제 #6
0
    IEnumerator Start()
    {
        while (vrtk_manager.modelAliasLeftController.transform.Find("body") == null || vrtk_manager.modelAliasRightController.transform.Find("body") == null)
        {
            yield return(new WaitForSeconds(0.1f));
        }

        leftInteractTouch       = vrtk_manager.scriptAliasLeftController.GetComponent <VRTK_InteractTouch> ();
        rightInteractTouch      = vrtk_manager.scriptAliasRightController.GetComponent <VRTK_InteractTouch> ();
        leftInteractUse         = vrtk_manager.scriptAliasLeftController.GetComponent <VRTK_InteractUse> ();
        rightInteractUse        = vrtk_manager.scriptAliasRightController.GetComponent <VRTK_InteractUse> ();
        rightControllerTooltips = vrtk_manager.scriptAliasRightController.GetComponentInChildren <VRTK_ControllerTooltips> ();
        leftControllerTooltips  = vrtk_manager.scriptAliasLeftController.GetComponentInChildren <VRTK_ControllerTooltips> ();

        playerInfoManager = FindObjectOfType <PlayerInfoManager> ();
        rightTeleporter   = vrtk_manager.scriptAliasRightController.transform.Find("Teleporter").gameObject;
        leftTeleporter    = vrtk_manager.scriptAliasLeftController.transform.Find("Teleporter").gameObject;

        FindObjectOfType <PlayerHealth> ().OnPlayerDied    += OnPlayerDied;
        FindObjectOfType <PlayerHealth> ().OnPlayerRevived += OnPlayerRevived;
        playerInfoManager.OnPlayerInfoViewOpened           += OnPlayerInfoOpenend;
        playerInfoManager.OnPlayerInfoViewClosed           += OnPlayerInfoClosed;

        SetOutfitterMode(OutfitterMode.EXPLORE);

        setupFinished = true;
    }
 private void OnDestroy()
 {
     if (this == sInstance)
     {
         sInstance = null;
     }
 }
예제 #8
0
        /// <summary>
        /// Устанавливает параметры игрока перед эвентом
        /// </summary>
        protected override void SetEventData(Client player, EventTeam team, int index)
        {
            var position = team == EventTeam.Red ? SniperBattleData.RedTeamPositions[index] : SniperBattleData.BlueTeamPositions[index];

            API.setEntityPosition(player, position);
            API.setEntityDimension(player, EVENT_DIMENSION);
            API.givePlayerWeapon(player, WeaponHash.HeavySniper, 50, true);
            var clothes = SniperBattleData.GetEventClothes(team, PlayerInfoManager.IsMale(player));

            GtaCharacter.SetClothes(player, clothes);
        }
예제 #9
0
 private void CreatePlayerList()
 {
     foreach (PhotonPlayer player in playersList)
     {
         GameObject        playerInfoObject  = Instantiate(PlayerInfoPrefab, PlayerScrollContent.transform);
         PlayerInfoManager playerInfoManager = playerInfoObject.GetComponent <PlayerInfoManager>();
         playerInfoManager.thisPlayer = player;
         playerInfoManager.UpdatePlayerInfo();
         playerInfoObjects.Add(playerInfoObject);
     }
 }
예제 #10
0
    void CmdFetchPlayerInfo()
    {
        PlayerInfoManager pim        = GameObject.Find("PlayerInfoManager").GetComponent <PlayerInfoManager>();
        PlayerInfo        serverInfo = pim.getPlayerInfo(identity.connectionToClient);

        NetworkWriter writer = new NetworkWriter();

        serverInfo.Serialize(writer);

        TargetSetPlayerInfo(identity.connectionToClient, writer.AsArray());
    }
예제 #11
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
예제 #12
0
        /// <summary>
        /// Устанавливает параметры игрока перед эвентом
        /// </summary>
        protected override void SetEventData(Client player, EventTeam team, int index)
        {
            var position = team == EventTeam.Red ? CountryBreakdownData.RedTeamPositions[index] : CountryBreakdownData.BlueTeamPositions[index];

            API.setEntityPosition(player, position);
            API.setEntityDimension(player, EVENT_DIMENSION);
            API.givePlayerWeapon(player, CountryBreakdownData.GetWeapon(), 300, true);
            var clothes = CountryBreakdownData.GetEventClothes(team, PlayerInfoManager.IsMale(player));

            GtaCharacter.SetClothes(player, clothes);
        }
예제 #13
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
 private void Awake()
 {
     playerInfos.Clear();
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
 void Awake()
 {
     if (sInstance == null)
     {
         sInstance = this;
         Setup();
     }
     else if (sInstance != this)
     {
         Destroy(this.gameObject);
         return;
     }
 }
예제 #16
0
 /// <summary>
 /// Set panel whit all player´s info
 /// </summary>
 /// <param name="status"></param>
 public void UpdateHUD()
 {
     Camera.main.GetComponent <SoundEffectsMenu>().PlayEffect(pageBook);
     close.gameObject.SetActive(true);
     panel.SetActive(true);
     info.gameObject.SetActive(true);
     nameTxt.gameObject.SetActive(true);
     playerName = string.IsNullOrEmpty(PlayerInfoManager.GetCurrentPlayerInfo().Name) ? "Player": PlayerInfoManager.GetCurrentPlayerInfo().Name;
     TextName();
     BestTime(PlayerInfoManager.GetCurrentPlayerInfo().Levels[levelSelector.CurrentLevelIndex].time);
     //record.gameObject.SetActive(status);
     //TextRecord(GameManager.instancia.BestRecord(GameManager.instancia.currLevel),GameManager.instancia.BestRecordMan(GameManager.instancia.currLevel));
 }
예제 #17
0
        public SingleRoomManager(ServerRoomFactory roomFactory, RoomEventDispatcher dispatcher, bool tokenOnce, IRoomListener roomListener)
        {
            _dispatcher              = dispatcher;
            _dispatcher.OnRoomEvent += OnRoomEvent;
            _playerInfoManager       = new PlayerInfoManager(tokenOnce);

            _roomFactory = roomFactory;
            roomFactory.TokenGenerator = _playerInfoManager;

            _roomListener = roomListener;

            _debugSystem = new ServerDebugInfoSystem(this);
        }
예제 #18
0
 /// <summary>
 /// Обработчик подмены документов
 /// </summary>
 private void FinishFalsification(Client player, object[] args)
 {
     PlayActionAnimation(player);
     player.resetSyncedData(IN_REPOSITORY);
     player.resetData(REPOSITORY_KEY);
     player.resetData(IN_REPOSITORY);
     SetQuestReward(player);
     ActionHelper.SetAction(3000, () => {
         PlayerInfoManager.SetPlayerClothes(player, true);
         _inventoryManager.EquipWeapon(player);
     });
     API.triggerClientEvent(player, ServerEvent.HIDE_CLAN_QUEST_POINTS);
 }
예제 #19
0
        /// <summary>
        /// Оплата аренды фургона
        /// </summary>
        private bool PayTrunkRent(Client player, int rentCost)
        {
            var playerInfo = PlayerInfoManager.GetInfo(player);

            if (playerInfo.Balance < rentCost)
            {
                API.sendNotificationToPlayer(player, "~r~Недостаточно денег для аренды фургона", true);
                return(false);
            }
            playerInfo.Balance -= rentCost;
            PlayerInfoManager.RefreshUI(player, playerInfo);
            return(true);
        }
        /// <summary>
        /// Получить зарплату
        /// </summary>
        private void GetSalary(Client player, object[] args)
        {
            var activeWork = WorkInfoManager.GetActiveWork(player);

            if (!WorkIsCorrect(player, activeWork, () => activeWork.Type == WorkType.Wrecker))
            {
                return;
            }
            WorkInfoManager.SetActivity(player, WorkType.Wrecker, false);
            player.resetData(WorkData.IS_WRECKER);
            PayOut(player, activeWork);
            PlayerInfoManager.SetPlayerClothes(player);
            API.triggerClientEvent(player, ServerEvent.HIDE_PARKING_FINE_MENU);
        }
        /// <summary>
        /// Завершить работу и получить зарплату
        /// </summary>
        private void GetSalary(Client player, object[] objects)
        {
            var activeWork = WorkInfoManager.GetActiveWork(player);

            if (!WorkIsCorrect(player, activeWork, () => activeWork.Type == WorkType.TaxiDriver))
            {
                return;
            }
            WorkInfoManager.SetActivity(player, WorkType.TaxiDriver, false);
            player.setData(WorkData.IS_TAXI_DIVER, null);
            PlayerInfoManager.SetPlayerClothes(player);
            PayOut(player, activeWork);
            API.triggerClientEvent(player, ServerEvent.HIDE_SIEMON_MENU);
        }
예제 #22
0
        /// <summary>
        /// Проверяет, что игроку доступен контракт банды
        /// </summary>
        private bool ClanRankEnough(Client player, int workLevel, int minLevel, ClanRank minRank)
        {
            if (!LevelEnough(player, workLevel, minLevel))
            {
                return(false);
            }
            var clanInfo = PlayerInfoManager.GetInfo(player).Clan;

            if (clanInfo == null || clanInfo.Rank < minRank)
            {
                API.sendNotificationToPlayer(player, $"~r~Необходимый ранг в банде \"{minRank.GetDescription()}\" и выше", true);
                return(false);
            }
            return(true);
        }
예제 #23
0
        /// <summary>
        /// Получение зарплаты дальнобойщика
        /// </summary>
        private void TruckerSalary(Client player, object[] args)
        {
            var activeWork = WorkInfoManager.GetActiveWork(player);

            if (!WorkIsCorrect(player, activeWork, () => activeWork.Type == WorkType.Trucker))
            {
                return;
            }
            WorkInfoManager.SetActivity(player, WorkType.Trucker, false);
            player.resetSyncedData(WorkData.IS_TRUCKER);
            player.resetData(WorkData.DELIVERY_CONTRACT);
            PayOut(player, activeWork);
            PlayerInfoManager.SetPlayerClothes(player);
            API.triggerClientEvent(player, ServerEvent.HIDE_TRUCKERS_MENU);
        }
        /// <summary>
        /// Получить зарплату
        /// </summary>
        private void GetSalary(Client player, object[] objects)
        {
            var activeWork = WorkInfoManager.GetActiveWork(player);

            if (!WorkIsCorrect(player, activeWork, () => activeWork.Type == WorkType.BusDriver))
            {
                return;
            }
            WorkInfoManager.SetActivity(player, WorkType.BusDriver, false);
            DecreaseRouteDriversCount(player);
            player.resetData(WorkData.IS_BUS_DRIVER);
            player.resetData(BusDriverManager.SHAPE_KEY);
            player.resetData(BusDriverManager.ROUTE_KEY);
            PlayerInfoManager.SetPlayerClothes(player);
            PayOut(player, activeWork);
            API.triggerClientEvent(player, ServerEvent.HIDE_ONEIL_MENU);
        }
예제 #25
0
        /// <summary>
        /// Получение зарплаты
        /// </summary>
        private void GetSalary(Client player, object[] args)
        {
            var activeWork = WorkInfoManager.GetActiveWork(player);

            bool TypeChecker() => activeWork.Type == WorkType.Builder;

            if (!WorkIsCorrect(player, activeWork, TypeChecker))
            {
                return;
            }
            WorkInfoManager.SetActivity(player, activeWork.Type, false);
            player.resetData(BuilderManager.BUILDER_POINT_KEY);
            player.resetSyncedData(WorkData.IS_BUILDER);
            PlayerInfoManager.SetPlayerClothes(player);
            PayOut(player, activeWork);
            API.triggerClientEvent(player, ServerEvent.HIDE_BUILDER_POINT);
            API.triggerClientEvent(player, ServerEvent.HIDE_BUILDER_MENU);
        }
        /// <summary>
        /// Получить зарплату
        /// </summary>
        private void GetSalary(Client player, object[] args)
        {
            var activeWork = WorkInfoManager.GetActiveWork(player);

            if (!WorkIsCorrect(player, activeWork, () => activeWork.Type == WorkType.Police))
            {
                return;
            }
            WorkInfoManager.SetActivity(player, WorkType.Police, false);
            player.resetData(WorkData.IS_POLICEMAN);
            player.resetSyncedData("HasPoliceActions");
            PayOut(player, activeWork);
            PlayerInfoManager.SetPlayerClothes(player);
            PlayerManager.SetPlayerName(player, PlayerInfoManager.GetInfo(player));
            _inventoryManager.EquipWeapon(player);
            _policeAlertManager.HideAllAlerts(player);
            API.triggerClientEvent(player, ServerEvent.HIDE_SARAH_MENU);
        }
        /// <summary>
        /// Получение зарплаты
        /// </summary>
        private void GetSalary(Client player, object[] args)
        {
            var activeWork = WorkInfoManager.GetActiveWork(player);

            bool TypeChecker() => activeWork.Type == WorkType.Fisherman;

            if (!WorkIsCorrect(player, activeWork, TypeChecker))
            {
                return;
            }
            WorkInfoManager.SetActivity(player, activeWork.Type, false);
            player.resetData(FishermanManager.FISHERMAN_POINT_KEY);
            player.resetSyncedData(WorkData.IS_FISHERMAN);
            player.resetSyncedData(WorkData.IS_FISHERMAN_ON_BOAT);
            PlayerInfoManager.SetPlayerClothes(player);
            PayOut(player, activeWork);
            API.triggerClientEvent(player, ServerEvent.HIDE_FISHERMAN_POINT);
            API.triggerClientEvent(player, ServerEvent.HIDE_FISHERMAN_MENU);
        }
예제 #28
0
        /// <summary>
        /// Получить зарплату
        /// </summary>
        private void GetSalary(Client player, object[] objects)
        {
            var activeWork = WorkInfoManager.GetActiveWork(player);

            bool TypeChecker() => activeWork.Type == WorkType.Forklift;

            if (!WorkIsCorrect(player, activeWork, TypeChecker))
            {
                return;
            }
            WorkInfoManager.SetActivity(player, activeWork.Type, false);
            API.resetEntityData(player, WorkData.IS_FORKLIFT);
            player.resetData(ForkliftManager.FORKLIFT_TAKE_KEY);
            player.resetData(ForkliftManager.FORKLIFT_PUT_KEY);
            PlayerInfoManager.SetPlayerClothes(player);
            PayOut(player, activeWork);
            API.triggerClientEvent(player, ServerEvent.HIDE_LOADER_POINTS);
            API.triggerClientEvent(player, ServerEvent.HIDE_FORKLIFT_MENU);
        }
예제 #29
0
    private void Start()
    {
        CurrentLevelIndex = 0;
        soundEffects      = Camera.main.GetComponent <SoundEffectsMenu>();
        levelsInfo        = PlayerInfoManager.GetCurrentPlayerInfo().Levels;
        Assert.IsNotNull(levelsInfo, "Error: Couldn't find the levelsInfo in LevelSelector\n<color=yellow>Tip: is PlayerInfoManager initialized?(Have you used/created GameManager?)</color>");

        int index = 0;

        for (int i = 1; i < levelsInfo.Length; i++)
        {
            if (levelsInfo[i].unlocked)
            {
                activateLevels.FastActiveSprite(index++);
            }
        }

        hud.UpdateHUD();
    }
예제 #30
0
        /// <summary>
        /// Обработчик входа в угоняемую машину
        /// </summary>
        private void OnEnterHijackedVehicle(Client player, NetHandle vehHandle, int seat)
        {
            var vehicle = API.getEntityFromHandle <Vehicle>(vehHandle);

            if (!vehicle.hasData(THIEFT_VEHICLE))
            {
                return;
            }
            var thiefName = vehicle.hasData(THIEF_NAME) ? (string)vehicle.getData(THIEF_NAME) : string.Empty;

            if (thiefName == player.name)
            {
                var playerClanId = PlayerInfoManager.GetInfo(player).Clan.ClanId;
                API.triggerClientEvent(player, ServerEvent.SHOW_CLAN_QUEST_END_POINT, VehicleTheftData.EndPointPositions[playerClanId]);
            }
            else
            {
                player.warpOutOfVehicle();
            }
        }
예제 #31
0
 void Start()
 {
     Instance = this;
     StartCoroutine(WaitForPlayer());
 }
예제 #32
0
	void CmdAdd() {
		infoManager = FindObjectOfType<PlayerInfoManager> ();
		player = infoManager.Register ("Haha");
		this.gameObject.name = player.ToString ();
		RpcAdd (player);
	}