示例#1
0
 public void OnEnable()
 {
     PhotonNetwork.AddCallbackTarget(this);
     DisableIfNotMine();
 }
 private void Awake()
 {
     PhotonNetwork.AddCallbackTarget(this);
     view = GetComponent <PhotonView>();
 }
 public override void OnEnable()
 {
     base.OnEnable();
     // register to photn callback functions
     PhotonNetwork.AddCallbackTarget(this);
 }
 public void Awake()
 {
     PhotonNetwork.AddCallbackTarget(this);
     PhotonNetwork.AutomaticallySyncScene = true;
     instance = this;
 }
示例#5
0
 private void Awake()
 {
     PhotonNetwork.AddCallbackTarget(this);
 }
示例#6
0
 public override void awake()
 {
     base.awake();
     UITool.SetActionTrue(this.skin);
     PhotonNetwork.AddCallbackTarget(this);
 }
示例#7
0
 public override void OnEnable()
 {
     base.OnEnable();
     PhotonNetwork.AddCallbackTarget(this);
     SceneManager.sceneLoaded += onSceneFinishedLoading; //setting up event listener for whenver we load a new scene. Whenever we call a new scene we call our onSceneFinishedLoading method.
 }
示例#8
0
        public override void OnServerStateEnter()
        {
            PhotonNetwork.AddCallbackTarget(this);
            responds = new bool[players.Count];
            var playerNames = RongPlayerIndices.Select(
                playerIndex => CurrentRoundStatus.GetPlayerName(playerIndex)
                ).ToArray();
            var handData = RongPlayerIndices.Select(
                playerIndex => CurrentRoundStatus.HandData(playerIndex)
                ).ToArray();
            var richiStatus = RongPlayerIndices.Select(
                playerIndex => CurrentRoundStatus.RichiStatus(playerIndex)
                ).ToArray();
            var multipliers = RongPlayerIndices.Select(
                playerIndex => gameSettings.GetMultiplier(CurrentRoundStatus.IsDealer(playerIndex), players.Count)
                ).ToArray();
            var totalPoints = RongPointInfos.Select((info, i) => info.BasePoint * multipliers[i]).ToArray();
            var netInfos    = RongPointInfos.Select(info => new NetworkPointInfo
            {
                Fu         = info.Fu,
                YakuValues = info.YakuList.ToArray(),
                Dora       = info.Dora,
                UraDora    = info.UraDora,
                RedDora    = info.RedDora,
                BeiDora    = info.BeiDora,
                IsQTJ      = info.IsQTJ
            }).ToArray();

            Debug.Log($"The following players are claiming rong: {string.Join(",", RongPlayerIndices)}, "
                      + $"PlayerNames: {string.Join(",", playerNames)}");
            var rongInfo = new EventMessages.RongInfo
            {
                RongPlayerIndices     = RongPlayerIndices,
                RongPlayerNames       = playerNames,
                HandData              = handData,
                WinningTile           = WinningTile,
                DoraIndicators        = MahjongSet.DoraIndicators,
                UraDoraIndicators     = MahjongSet.UraDoraIndicators,
                RongPlayerRichiStatus = richiStatus,
                RongPointInfos        = netInfos,
                TotalPoints           = totalPoints
            };

            // send rpc calls
            ClientBehaviour.Instance.photonView.RPC("RpcRong", RpcTarget.AllBufferedViaServer, rongInfo);
            // get point transfers
            transfers = new List <PointTransfer>();
            for (int i = 0; i < RongPlayerIndices.Length; i++)
            {
                var rongPlayerIndex = RongPlayerIndices[i];
                var point           = RongPointInfos[i];
                var multiplier      = multipliers[i];
                int pointValue      = point.BasePoint * multiplier;
                int extraPoints     = i == 0 ? CurrentRoundStatus.ExtraPoints * (players.Count - 1) : 0;
                transfers.Add(new PointTransfer
                {
                    From   = CurrentPlayerIndex,
                    To     = rongPlayerIndex,
                    Amount = pointValue + extraPoints
                });
            }

            // richi-sticks-points
            transfers.Add(new PointTransfer
            {
                From   = -1,
                To     = RongPlayerIndices[0],
                Amount = CurrentRoundStatus.RichiSticksPoints
            });
            next = !RongPlayerIndices.Contains(CurrentRoundStatus.OyaPlayerIndex);
            // determine server time out
            serverTimeOut = ServerMaxTimeOut * RongPointInfos.Length + ServerConstants.ServerTimeBuffer;
            firstTime     = Time.time;
        }
示例#9
0
        /// <summary>
        /// The object has been enabled.
        /// </summary>
        protected override void OnEnable()
        {
            base.OnEnable();

            PhotonNetwork.AddCallbackTarget(this);
        }
示例#10
0
 private void Start()
 {
     CreatePlayer();
     PhotonNetwork.AddCallbackTarget(this);
 }
示例#11
0
 public override void OnEnable()
 {
     PhotonNetwork.AddCallbackTarget(this);
     PhotonNetwork.AutomaticallySyncScene = true;
 }
 public ConnectionManager()
 {
     PhotonNetwork.AddCallbackTarget(this);
 }
示例#13
0
 public override void OnEnable()
 {
     SceneManager.sceneLoaded += OnSceneFinishedLoading;
     PhotonNetwork.AddCallbackTarget(this);
 }
 public virtual void Initialize()
 {
     PhotonNetwork.AddCallbackTarget(this);
 }
示例#15
0
 /// <summary>
 /// OnEnable Unity function. Make sure to call base.OnEnable() if overriding
 /// </summary>
 protected virtual void OnEnable() => PhotonNetwork.AddCallbackTarget(this);
示例#16
0
 public virtual void OnEnable()
 {
     PhotonNetwork.AddCallbackTarget(this);
 }
 private void Start()
 {
     PhotonNetwork.AddCallbackTarget(this);
 }
示例#18
0
 public override void OnDisable()
 {
     base.OnEnable();
     PhotonNetwork.AddCallbackTarget(this);
     SceneManager.sceneLoaded -= OnSceneFinishedLoading;
 }
        private void OnEnable()
        {
            PhotonNetwork.AddCallbackTarget(this);

            StartCoroutine(AddPlayerDeathListener());
        }
示例#20
0
 public override void OnEnable()
 {
     //Register to photon callbacks
     PhotonNetwork.AddCallbackTarget(this);
 }
示例#21
0
    private int multiplayerSceneIndex; // num for build index to scene

    public override void OnEnable()    // trigerred on LobbyController
    {
        PhotonNetwork.AddCallbackTarget(this);
    }
    private int multiplayerSceneIndex; //Number for the build index to the multiplay scene


    public override void OnEnable()
    {
        PhotonNetwork.AddCallbackTarget(this);
    }
示例#23
0
 public override void OnEnable()
 {
     base.OnEnable();
     PhotonNetwork.AddCallbackTarget(this);
     //Scene
 }
 private void OnEnable()
 {
     PhotonNetwork.AddCallbackTarget(this);
 }
示例#25
0
 public PhotonRoomManager()
 {
     PhotonNetwork.AddCallbackTarget(this);
 }