示例#1
0
        public void Shoot_RPC(Vector3 position, Quaternion rotation, int ID)
        {
            Photon.Pun.PhotonView character = Photon.Pun.PhotonView.Find(ID);

            BulletController bullet = BulletsPool.Pool.GetBullet();
            GunStats         gstats = getGunStats();

            bullet.Initilize(position, rotation, gstats.power, gstats.Damage, gstats.lifeTime, character.IsMine);

            shotSource.PlayOneShot(shotNoise, GameConfiguration.EffectsLevel);
            muzzle.gameObject.SetActive(true);
            muzzle.Play(true);

            float max = getGunStats().MaxRecoil;

            recoilTarget.x += Random.Range(-max, max);
            recoilTarget.y += Random.Range(-max, max);
            recoilTarget.z += Random.Range(-max, max);


            ActualAmmo--;
            ShootedBullets++;

            bullet.gameObject.SetActive(true);
        }
示例#2
0
        internal static bool Prefix(VRRig __instance, float red, float green, float blue)
        {
            var controller = __instance.gameObject.GetComponent <ICustomCosmeticsController>();

            if (controller == null)
            {
                return(true);
            }

            controller.SetColor(red, green, blue);

            Photon.Pun.PhotonView photView = __instance.photonView;
            if (photView != null)
            {
                __instance.playerText.text = __instance.NormalizeName(true, photView.Owner.NickName);
            }
            else if (__instance.showName)
            {
                __instance.playerText.text = PlayerPrefs.GetString("playerName");
            }

            return(false);

            /*
             * if (controller != null)
             * {
             *      controller.SetColor(red, green, blue);
             * }
             * var boolean = controller?.CurrentMaterial?.Descriptor.CustomColors ?? true;
             * return boolean;
             */
        }
示例#3
0
        /** constructor。
         */
        public Sync(UnityEngine.GameObject a_networkobject)
        {
                        #if (USE_DEF_FEE_PUN)
            this.player_sync = a_networkobject.AddComponent <Pun_Sync_Player_MonoBehaviour>();
            this.player_sync.SetSync(this);

            this.status_sync = a_networkobject.AddComponent <Pun_Sync_Status_MonoBehaviour>();
            this.status_sync.SetSync(this);

            this.player_view = a_networkobject.AddComponent <Photon.Pun.PhotonView>();
            this.status_view = a_networkobject.AddComponent <Photon.Pun.PhotonView>();

            this.player_stream_send = new Pun_Stream();
            this.player_stream_recv = new Pun_Stream();
            this.status_stream_send = new Pun_Stream();
            this.status_stream_recv = new Pun_Stream();

            this.status_interval     = 0;
            this.status_interval_max = Config.DEFAULT_PLAYER_STATUS_SEND_INTERVAL;

            {
                this.player_view.ObservedComponents = new System.Collections.Generic.List <UnityEngine.Component>();
                this.player_view.ObservedComponents.Add(this.player_sync);
                this.status_view.ObservedComponents = new System.Collections.Generic.List <UnityEngine.Component>();
                this.status_view.ObservedComponents.Add(this.status_sync);
            }
                        #endif
        }
        void RPCTake(int itemID)
        {
            Photon.Pun.PhotonView pv   = Photon.Pun.PhotonView.Find(itemID);
            ItemController        item = pv.GetComponent <ItemController>();

            if (item != null)
            {
                inventary.AddItem(this, item);
            }
        }
示例#5
0
        String startPath;                               // The Unity Application Starting Path

        private void Awake()
        {
            _photonView   = GetComponent <Photon.Pun.PhotonView>();
            _playerSkill  = GetComponent <PlayerSkill>();
            _playerStatus = GetComponent <PlayerStatus>();

            if (!GetComponent <Photon.Pun.PhotonView>().IsMine)
            {
                Destroy(this);
            }
        }
示例#6
0
        public PhotonTransporter(int id)
        {
            var photon = new UnityEngine.GameObject("PhotonTransporter", typeof(Photon.Pun.PhotonView), typeof(PhotonReceiver));

            this.photonReceiver = photon.GetComponent <PhotonReceiver>();
            var view = photon.GetComponent <Photon.Pun.PhotonView>();

            view.ViewID = id;
            Photon.Pun.PhotonNetwork.RegisterPhotonView(view);

            this.photonView = view;

            this.photonReceiver.Initialize();
        }
示例#7
0
        /** 開始。
         */
        void Start()
        {
            Tool.Log("Player", "Start");

            //トランスフォーム。
            this.mytransform = this.GetComponent <UnityEngine.Transform>();

            //親。設定。
            UnityEngine.Transform t_root = Fee.Network.Network.GetInstance().GetRoot();
            this.GetComponent <UnityEngine.Transform>().SetParent(t_root);

            //photon_view
                        #if (USE_DEF_FEE_PUN)
            this.photon_view = this.GetComponent <Photon.Pun.PhotonView>();
                        #endif

                        #if (USE_DEF_FEE_PUN)
            {
                //is_mine
                this.is_mine = this.photon_view.IsMine;
            }
                        #else
            {
                //is_mine
                this.is_mine = true;
            }
                        #endif

            //playerlist_index
            this.playerlist_index = -1;

            //this.name
            this.name = "Player";

            {
                //プレイヤ-インデックス取得。
                this.playerlist_index = Fee.Network.Network.GetInstance().AddPlayer(this);

                //名前設定。
                if (this.playerlist_index >= 0)
                {
                    this.name = "Player_" + this.playerlist_index.ToString();
                }
            }
        }
示例#8
0
        public static bool OnPortalEnter(PortalInternal __instance)
        {
            if (!AskToPortalSettings.enabled)
            {
                return(true);
            }
            if (!hasTriggered)
            {
                Photon.Pun.PhotonView photonView = __instance.gameObject.GetComponent <Photon.Pun.PhotonView>();
                APIUser dropper;
                if (photonView == null)
                {
                    dropper = new APIUser(displayName: "Not Player Dropped", id: "");
                }
                else
                {
                    dropper = cachedDroppers[__instance.GetInstanceID()].field_Private_APIUser_0; // Get cached user because the photon object before gets the owner and can be spoofed
                }

                if (blacklistedUserIds.Contains(dropper.id))
                {
                    return(false);
                }

                string   roomId   = __instance.field_Private_String_1;
                string   worldId  = __instance.field_Private_ApiWorld_0.id;
                int      roomPop  = __instance.field_Private_Int32_0;
                RoomInfo roomInfo = new RoomInfo();
                if (roomId == null)
                {
                    if (dropper.id != "")
                    {
                        roomInfo.isPortalDropper = true;                   //If there is a dropper but the portal has no room id
                    }
                    roomInfo.instanceType = "Unknown";
                }
                else
                {
                    roomInfo = ParseRoomId(roomId);
                }

                //If portal dropper is not owner of private instance but still dropped the portal or world id is the public ban world or if the population is in the negatives or is above 80
                if ((roomInfo.ownerId != "" && roomInfo.ownerId != dropper.id && !roomInfo.instanceType.Contains("Friend")) || worldId == "wrld_5b89c79e-c340-4510-be1b-476e9fcdedcc" || roomPop < 0 || roomPop > 80)
                {
                    roomInfo.isPortalDropper = true;
                }

                if (roomInfo.isPortalDropper && !(AskToPortalSettings.autoAcceptSelf && dropper.IsSelf))
                {
                    popupV2.Invoke(VRCUiPopupManager.prop_VRCUiPopupManager_0, new object[7] {
                        "Portal Dropper Detected!!!",
                        $"This portal was likely dropped by someone malicious! Only go into this portal if you trust {dropper.displayName}. Pressing \"Leave and Blacklist\" will blacklist {dropper.displayName}'s portals until the game restarts",
                        "Enter", (Il2CppSystem.Action) new Action(() =>
                        {
                            closePopup.Invoke(VRCUiPopupManager.prop_VRCUiPopupManager_0, null);

                            if (__instance == null)
                            {
                                object currentPortalInfo = Activator.CreateInstance(portalInfo);
                                currentPortalInfo.GetType().GetProperty($"field_Public_{portalInfoEnum.Name}_0").SetValue(currentPortalInfo, portalInfoEnum.GetEnumValues().GetValue(3)); //I hate reflection
                                typeof(Il2CppSystem.Collections.Generic.Dictionary <string, string>).GetMethod("Add").Invoke(currentPortalInfo.GetType().GetProperty("field_Public_Dictionary_2_String_String_0").GetValue(currentPortalInfo), new object[2] {
                                    "transitionPortalType", dropper.id == "" ? "Static" : "Dynamic"
                                });
                                typeof(Il2CppSystem.Collections.Generic.Dictionary <string, string>).GetMethod("Add").Invoke(currentPortalInfo.GetType().GetProperty("field_Public_Dictionary_2_String_String_0").GetValue(currentPortalInfo), new object[2] {
                                    "transitionPortalOwner", dropper.id
                                });
                                enterWorld.Invoke(VRCFlowManager.prop_VRCFlowManager_0, new object[5] {
                                    worldId, roomId, currentPortalInfo, (Il2CppSystem.Action <string>) new Action <string>((str) => popupV2Small.Invoke(VRCUiPopupManager.prop_VRCUiPopupManager_0, new object[5] {
                                        "Alert", "Cannot Join World", "Close", (Il2CppSystem.Action) new Action(() => closePopup.Invoke(VRCUiPopupManager.prop_VRCUiPopupManager_0, null)), null
                                    })), false
                                });                                                                                                                                                                                                                                                                                                                                                                                                                           //Just kill me
                            }
                            else
                            {
                                hasTriggered = true;
                                try
                                {
                                    enterPortal.Invoke(__instance, null);
                                }
                                catch {}
                            }
                        }), "Leave and Blacklist", (Il2CppSystem.Action) new Action(() => { closePopup.Invoke(VRCUiPopupManager.prop_VRCUiPopupManager_0, null); blacklistedUserIds.Add(dropper.id); }), null
                    });
                    return(false);
                }
                else if (ShouldCheckUserPortal(dropper) && !(AskToPortalSettings.autoAcceptHome && __instance.field_Internal_Boolean_1) && !AskToPortalSettings.onlyPortalDrop)
                {
                    popupV2.Invoke(VRCUiPopupManager.prop_VRCUiPopupManager_0, new object[7] {
                        "Enter This Portal?",
                        $"Do you want to enter this portal?{Environment.NewLine}World Name: {__instance.field_Private_ApiWorld_0.name}{Environment.NewLine}Dropper: {dropper.displayName}{Environment.NewLine}Instance Type: {roomInfo.instanceType}",
                        "Yes", (Il2CppSystem.Action) new Action(() =>
                        {
                            closePopup.Invoke(VRCUiPopupManager.prop_VRCUiPopupManager_0, null);

                            if (__instance == null)
                            {
                                object currentPortalInfo = Activator.CreateInstance(portalInfo);
                                currentPortalInfo.GetType().GetProperty($"field_Public_{portalInfoEnum.Name}_0").SetValue(currentPortalInfo, portalInfoEnum.GetEnumValues().GetValue(3)); //I hate reflection
                                typeof(Il2CppSystem.Collections.Generic.Dictionary <string, string>).GetMethod("Add").Invoke(currentPortalInfo.GetType().GetProperty("field_Public_Dictionary_2_String_String_0").GetValue(currentPortalInfo), new object[2] {
                                    "transitionPortalType", dropper.id == "" ? "Static" : "Dynamic"
                                });
                                typeof(Il2CppSystem.Collections.Generic.Dictionary <string, string>).GetMethod("Add").Invoke(currentPortalInfo.GetType().GetProperty("field_Public_Dictionary_2_String_String_0").GetValue(currentPortalInfo), new object[2] {
                                    "transitionPortalOwner", dropper.id
                                });
                                enterWorld.Invoke(VRCFlowManager.prop_VRCFlowManager_0, new object[5] {
                                    worldId, roomId, currentPortalInfo, (Il2CppSystem.Action <string>) new Action <string>((str) => popupV2Small.Invoke(VRCUiPopupManager.prop_VRCUiPopupManager_0, new object[5] {
                                        "Alert", "Cannot Join World", "Close", (Il2CppSystem.Action) new Action(() => closePopup.Invoke(VRCUiPopupManager.prop_VRCUiPopupManager_0, null)), null
                                    })), false
                                });                                                                                                                                                                                                                                                                                                                                                                                                                           //Just kill me
                            }
                            else
                            {
                                hasTriggered = true;
                                try
                                {
                                    enterPortal.Invoke(__instance, null);
                                }
                                catch {}
                            }
                        }), "No", (Il2CppSystem.Action) new Action(() => closePopup.Invoke(VRCUiPopupManager.prop_VRCUiPopupManager_0, null)), null
                    });

                    return(false);
                }
            }
            hasTriggered = false;
            return(true);
        }
示例#9
0
        public static bool OnPortalEnter(PortalInternal __instance)
        {
            if (!AskToPortalSettings.enabled.Value)
            {
                return(true);
            }
            if (!shouldInterrupt)
            {
                return(true);
            }

            Photon.Pun.PhotonView photonView = __instance.gameObject.GetComponent <Photon.Pun.PhotonView>();
            APIUser dropper;

            if (photonView == null)
            {
                dropper = new APIUser(displayName: "Not Player Dropped", id: "");
            }
            else
            {
                dropper = cachedDroppers[__instance.GetInstanceID()].prop_APIUser_0; // Get cached user because the photon object before gets the owner and can be spoofed
            }
            if (blacklistedUserIds.Contains(dropper.id))
            {
                return(false);
            }
            if (!ShouldCheckUserPortal(dropper, photonView == null))
            {
                return(true);
            }

            string roomId  = __instance.field_Private_String_1;
            string worldId = __instance.field_Private_ApiWorld_0.id;
            int    roomPop = __instance.field_Private_Int32_0;

            RoomInfo roomInfo;

            if (photonView == null)
            {
                roomInfo = new RoomInfo();
            }
            else
            {
                roomInfo = new RoomInfo(roomId);
            }

            //If portal dropper is not owner of private instance but still dropped the portal or world id is the public ban world or if the population is in the negatives or is above 80
            if (!string.IsNullOrWhiteSpace(roomInfo.ownerId) && roomInfo.ownerId != dropper.id && !roomInfo.instanceType.Contains("Public"))
            {
                roomInfo.errors.Add("Instance type was non-public and the owner of the instance did not match the dropper of the portal");
            }

            if (worldId == "wrld_5b89c79e-c340-4510-be1b-476e9fcdedcc")
            {
                roomInfo.errors.Add("Portal leads to the public ban world, which is used almost exclusively by portal droppers");
            }

            if (roomPop < 0 || roomPop > 80)
            {
                roomInfo.errors.Add("Room population was an invalid value");
            }

            MenuManager.OnPortalEnter(roomInfo, __instance, dropper, worldId, roomId);
            return(false);
        }