Example #1
0
 private void onPropSpawned(Prop prop)
 {
     if (dataEntityCollection.TryGetComponent <SessionIdData>(prop.PropUserRef.PlayerHandle, out var component))
     {
         FishBucketPlayerData fishBucketPlayerData = playerData[component.SessionId];
         FishBucketBucket     component2           = prop.GetComponent <FishBucketBucket>();
         component2.SetBucketColor(fishBucketPlayerData.PlayerNum);
         playerData[component.SessionId].BucketReference = component2;
         Service.Get <EventDispatcher>().DispatchEvent(new UIDisablerEvents.DisableUIElement("Joystick", hideElement: true));
     }
     prop.PropUserRef.EPropSpawned -= onPropSpawned;
 }
Example #2
0
 private void handleShowTurnOutput(PartyGameSessionMessages.ShowTurnOutput data)
 {
     changeControlState(ControlsState.Disabled);
     if (currentState != FishBucketState.Game)
     {
         return;
     }
     if (!playersAbandonded.Contains(data.PlayerId))
     {
         FishBucketPlayerData fishBucketPlayerData = playerData[data.PlayerId];
         fishBucketPlayerData.Score = Math.Max(fishBucketPlayerData.Score + data.ScoreDelta, 0);
         hudUI.ShowTurn(fishBucketPlayerData, data.ScoreDelta);
         animationController.ShowTurnOutput(data.PlayerId, data.ScoreDelta);
         if (fishBucketPlayerData.BucketReference != null)
         {
             fishBucketPlayerData.BucketReference.SetFillAmount(fishBucketPlayerData.Score);
         }
     }
     CoroutineRunner.Start(waitForTurnSequenceComplete(data.ScoreDelta), this, "WaitForTurnSequenceComplete");
 }
Example #3
0
        private void initPlayerData()
        {
            string displayName = "";

            playerData = new Dictionary <long, FishBucketPlayerData>();
            for (int i = 0; i < base.players.Count; i++)
            {
                long             userSessionId = base.players[i].UserSessionId;
                DataEntityHandle handle        = Service.Get <CPDataEntityCollection>().FindEntity <SessionIdData, long>(userSessionId);
                if (dataEntityCollection.TryGetComponent <DisplayNameData>(handle, out var component))
                {
                    displayName = component.DisplayName;
                }
                FishBucketPlayerData value = new FishBucketPlayerData(userSessionId, i + 1, localPlayerSessionId == userSessionId, displayName);
                if (dataEntityCollection.TryGetComponent <GameObjectReferenceData>(handle, out var component2))
                {
                    component2.GameObject.GetComponent <PropUser>().EPropSpawned += onPropSpawned;
                }
                playerData[userSessionId] = value;
            }
        }