//! Loads data from .sav file.
    private void LoadDataFromFile()
    {
        inventory = new InventorySlot[16];
        int count = 0;

        while (count <= 15)
        {
            inventory[count] = gameObject.AddComponent <InventorySlot>();
            string countType = FileBasedPrefs.GetString(stateManager.worldName + "inventory" + ID + "slot" + count + "type");
            if (!countType.Equals(""))
            {
                inventory[count].typeInSlot   = FileBasedPrefs.GetString(stateManager.worldName + "inventory" + ID + "slot" + count + "type");
                inventory[count].amountInSlot = FileBasedPrefs.GetInt(stateManager.worldName + "inventory" + ID + "slot" + count + "amount");
            }
            count++;
        }
        originalID   = ID;
        initialized  = true;
        maxStackSize = ID.Equals("Rocket") ? 100000 : 1000;
    }
示例#2
0
    private void OnMouseDown()
    {
        if (this.gameObject.name == "Cover")
        {
            gameObject.GetComponent <Animator>().enabled = true;
            StartCoroutine(waitFor1());
        }
        else if (!FileBasedPrefs.HasKey(this.gameObject.name + "anime"))
        {
            gameObject.GetComponent <Animator> ().enabled = true;
            if (hasAudio)
            {
                gameObject.GetComponent <AudioSource>().enabled = true;
            }
            FileBasedPrefs.SetInt(this.gameObject.name + "anime", 1);
            StartCoroutine(waitFor1());

            //gameObject.GetComponent<Animator> ().enabled = false;
        }
    }
示例#3
0
 void check()
 {
     if (waitForPhoto)
     {
         if (albumReff.activeSelf && FileBasedPrefs.HasKey("photoPuzzCompleted"))
         {
             foreach (GameObject item in examine)
             {
                 item.SetActive(false);
             }
         }
     }
     else if (FileBasedPrefs.HasKey("photoPuzzCompleted"))
     {
         foreach (GameObject item in examine)
         {
             item.SetActive(false);
         }
     }
 }
示例#4
0
    // Update is called once per frame
    void Update()
    {
        if (puzzleDone())
        {
            cabinet.SetActive(true);

            SteamHandler.instance.SetAch(SteamACH1);



            examineCabinet.SetActive(false);
            examineMirror.SetActive(false);
            if (!FileBasedPrefs.HasKey("soundPlayed"))
            {
                FileBasedPrefs.SetInt("soundPlayed", 1);
                SoundManager.Instance.gameSounds[9].Play();
            }
            Debug.Log("done");
        }
    }
    void GeneralTests()
    {
        FileBasedPrefs.SetString("test", "test");

        if (!FileBasedPrefs.HasKey("test"))
        {
            Debug.LogException(new System.Exception("HasKeyFailed"));
            return;
        }

        //FileBasedPrefs.DeleteKey("test");

        //if (FileBasedPrefs.HasKey("test"))
        //{
        //    Debug.LogException(new System.Exception("DeleteKeyFailed"));
        //    return;
        //}

        Debug.Log("General Tests Passed");
    }
示例#6
0
 // Token: 0x06000A7C RID: 2684 RVA: 0x00041394 File Offset: 0x0003F594
 private void OnPhotonJoinRoomFailed()
 {
     if (this.connectionAttempts == 6)
     {
         if (XRDevice.isPresent)
         {
             this.localPlayer = Object.Instantiate <GameObject>(this.vrPlayerModel, this.spawns[Random.Range(0, this.spawns.Count)].position, Quaternion.identity).GetComponent <Player>();
         }
         else
         {
             this.localPlayer = Object.Instantiate <GameObject>(this.pcPlayerModel, this.spawns[Random.Range(0, this.spawns.Count)].position, Quaternion.identity).GetComponent <Player>();
             this.pcManager.SetValues();
         }
         this.LoadRewardScreens();
         FileBasedPrefs.SetInt("StayInServerRoom", 0);
         return;
     }
     this.connectionAttempts++;
     base.StartCoroutine(this.AttemptToJoinRoomAfterDelay());
 }
 private void OnMouseDown()
 {
     bothash.AlbumManager.Instance.Save();
     bothash.InventoryManager.instance.saveToDB();
     FirstFloorSave.Instance.Save();
     foreach (GameObject manager in managers)
     {
         Destroy(manager);
     }
     if (!FileBasedPrefs.HasKey("inGameSceneChange"))
     {
         FileBasedPrefs.SetInt("inGameSceneChange", 1);
     }
     if (!FileBasedPrefs.HasKey("showStairCase"))
     {
         FileBasedPrefs.SetInt("showStairCase", 1);
     }
     FileBasedPrefs.SetInt("CurrentScene", 1);
     SceneManager.LoadScene(0);
 }
 private void OnMouseDown()
 {
     bothash.AlbumManager.Instance.Save();
     bothash.InventoryManager.instance.saveToDB();
     GroundFloorSave.Instance.Save();
     foreach (GameObject manager in managers)
     {
        Destroy(manager);
     } 
     if(!FileBasedPrefs.HasKey("inGameSceneChange")){
         FileBasedPrefs.SetInt("inGameSceneChange",1);
         Debug.Log("***** FileBasedPrefset ****");
     }
     if (this.gameObject.name=="chimneyNav" && !FileBasedPrefs.HasKey("chimneyNav")) {
         FileBasedPrefs.SetInt(this.gameObject.name,1);
     }
     FileBasedPrefs.SetInt("CurrentScene", 2);
     SceneManager.LoadScene(0);
     
 }
示例#9
0
 public void PlayVent()
 {
     if (FileBasedPrefs.HasKey(gameObject.name))
     {
         gameObject.GetComponent <Animator>().enabled = false;
         return;
     }
     else
     {
         if (Input.GetMouseButtonDown(0))
         {
             FileBasedPrefs.SetString(gameObject.name, "showed_once");
             if (GetComponent <Animator>() != null)
             {
                 GetComponent <Animator>().enabled = true;
             }
             Debug.LogError("Destroy obj");
             //gameObject.SetActive(false);
         }
     }
 }
    void Start()
    {
        if (DeleteAtStart)
        {
            FileBasedPrefs.DeleteAll();
        }
        if (SpeedTest)
        {
            for (int i = 0; i < 10; i++)
            {
                FileBasedPrefs.SetString("SpeedTest" + i, "SpeedTest" + i);
            }
            return;
        }

        Invoke("StringTests", 0.25f);
        Invoke("IntTests", 0.5f);
        Invoke("FloatTests", 0.75f);
        Invoke("BoolTests", 1f);
        Invoke("GeneralTests", 1.25f);
    }
示例#11
0
    // Token: 0x06000A79 RID: 2681 RVA: 0x00041238 File Offset: 0x0003F438
    public void SetPlayerName()
    {
        string text = "Unkwown";

        if (this.storeSDKManager.storeSDKType == StoreSDKManager.StoreSDKType.steam)
        {
            text = (SteamManager.Initialized ? SteamFriends.GetPersonaName() : "Unkwown");
        }
        else if (this.storeSDKManager.storeSDKType == StoreSDKManager.StoreSDKType.viveport)
        {
            text = (ViveportInitialiser.Initialized ? User.GetUserName() : "Unkwown");
        }
        if (text == "Goldberg")
        {
            FileBasedPrefs.SetInt("StayInServerRoom", 0);
            PhotonNetwork.offlineMode = true;
            text = "I pirated the game";
            Debug.Log("I pirated the game");
        }
        PhotonNetwork.playerName = text;
    }
示例#12
0
    public void InitiateThirdParty()
    {
        if (isSteamACH)
        {
            Debug.Log("ach set for " + SteamACH);
            SteamHandler.instance.SetAch(SteamACH);
        }

        if (isMultipleObject)
        {
            foreach (GameObject obj in otherObjects)
            {
                obj.SetActive(true);
            }
        }
        else
        {
            Debug.Log("Initiating Thrd Party");
            Debug.Log(string.Format("Third Party Object Name: {0}", ThirdPartyObject.name));

            ThirdPartyObject.SetActive(true);

            if (StartAnim)
            {
                AnimationComponent.enabled = true;
            }
            if (haveDialogues)
            {
                bothash.DialogueM.Instance.sentence = Dialogues.sentences;
                bothash.DialogueM.Instance.Avatar   = character;
                bothash.DialogueM.Instance.Audio    = Dialogues.Audios;
                bothash.DialogueM.Instance.startDialogue();
            }
            if (this.gameObject.name == "Fireplace")
            {
                FileBasedPrefs.SetInt("darkRoomActivated", 1);
            }
        }
    }
示例#13
0
 void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
         //DontDestroyOnLoad(gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
     if (File.Exists(Application.persistentDataPath + "/GameData/game_Data1.botHash"))
     {
         LoadGameData();
     }
     if (FileBasedPrefs.HasKey("inGameSceneChange"))
     {
         FileBasedPrefs.DeleteKey("inGameSceneChange");
         mainScreen.SetActive(false);
         allRooms.SetActive(true);
         Debug.Log("+++++++******");
     }
     if (FileBasedPrefs.HasKey("chimneyNav"))
     {
         FileBasedPrefs.DeleteKey("chimneyNav");
         for (int i = 0; i < 27; i++)
         {
             if (i == 16)
             {
                 objects[i].SetActive(true);
             }
             else
             {
                 objects[i].SetActive(false);
             }
         }
     }
 }
示例#14
0
    public static String[] GetStringArray(String key)
    {
        if (FileBasedPrefs.HasKey(key))
        {
            var completeString = FileBasedPrefs.GetString(key);
            var separatorIndex = completeString.IndexOf("|"[0]);
            if (separatorIndex < 4)
            {
                Debug.LogError("Corrupt preference file for " + key);
                return(new String[0]);
            }
            var bytes = System.Convert.FromBase64String(completeString.Substring(0, separatorIndex));
            if ((ArrayType)bytes[0] != ArrayType.String)
            {
                Debug.LogError(key + " is not a string array");
                return(new String[0]);
            }
            Initialize();

            var numberOfEntries = bytes.Length - 1;
            var stringArray     = new String[numberOfEntries];
            var stringIndex     = separatorIndex + 1;
            for (var i = 0; i < numberOfEntries; i++)
            {
                int stringLength = bytes[idx++];
                if (stringIndex + stringLength > completeString.Length)
                {
                    Debug.LogError("Corrupt preference file for " + key);
                    return(new String[0]);
                }
                stringArray[i] = completeString.Substring(stringIndex, stringLength);
                stringIndex   += stringLength;
            }

            return(stringArray);
        }
        return(new String[0]);
    }
示例#15
0
        IEnumerator waitForAnim()
        {
            yield return(new WaitForSeconds(0.4f));

            SteamHandler.instance.SetAch(SteamACH1);
            OpenBox.SetActive(true);
            if (FileBasedPrefs.HasKey("bigPuzzCount"))
            {
                FileBasedPrefs.SetInt("bigPuzzCount", FileBasedPrefs.GetInt("bigPuzzCount") + 1);
            }
            else
            {
                FileBasedPrefs.SetInt("bigPuzzCount", 1);
            }
            Debug.Log(FileBasedPrefs.GetInt("bigPuzzCount"));
            if (FileBasedPrefs.GetInt("bigPuzzCount") >= 8)
            {
                SteamHandler.instance.SetAch(SteamACH);
            }

            FileBasedPrefs.SetString(this.gameObject.name, "Done");
            puzzleBox.SetActive(false);
        }
示例#16
0
 // Token: 0x060007CE RID: 1998 RVA: 0x0002E4D0 File Offset: 0x0002C6D0
 public void Quit()
 {
     if (GameController.instance)
     {
         if (GameController.instance.isTutorial)
         {
             FileBasedPrefs.SetInt("MissionStatus", 3);
             FileBasedPrefs.SetInt("setupPhase", 0);
             FileBasedPrefs.SetInt("completedTraining", 1);
             FileBasedPrefs.SetInt("StayInServerRoom", 0);
         }
         if (GameController.instance.myPlayer.player.isDead)
         {
             FileBasedPrefs.SetInt("PlayerDied", 1);
             InventoryManager.RemoveItemsFromInventory();
         }
         else
         {
             FileBasedPrefs.SetInt("PlayerDied", 0);
         }
     }
     Application.Quit();
 }
示例#17
0
        public static void AddMaxItems()
        {
            foreach (var inventoryItem in _inventoryManager.field_Public_List_1_InventoryItem_0)
            {
                var itemName  = inventoryItem.field_Public_String_0;
                var keyConfig = itemName + "Inventory";
                var nb        = FileBasedPrefs.GetInt(keyConfig);
                //MelonLogger.Log("Adding " + itemName);
                var max    = inventoryItem.field_Public_Int32_2;
                var cur    = inventoryItem.field_Public_Int32_1;
                var remain = max - cur;

                //MelonLogger.Log($"Current count: {cur} Maximum: {max} Player count: {nb}");
                if (nb < remain || remain <= 0)
                {
                    continue;
                }
                FileBasedPrefs.SetInt(keyConfig, nb - remain);
                MelonCoroutines.Start(AddNumberOf(inventoryItem, remain));
            }

            MelonLogger.Log("finished");
        }
示例#18
0
    private void SyncValuesNetworked(int ghostType, int ghostAge, bool isMale, string ghostName, bool isShy, int deathLength, int favouriteRoomID)
    {
        GhostTraits ghostTraits = new GhostTraits
        {
            ghostType       = (GhostTraits.Type)ghostType,
            ghostAge        = ghostAge,
            isMale          = isMale,
            ghostName       = ghostName,
            isShy           = isShy,
            deathLength     = deathLength,
            favouriteRoomID = favouriteRoomID
        };

        FileBasedPrefs.SetString("GhostType", LocalisationSystem.GetLocalisedValue("Journal_" + (GhostTraits.Type)ghostType + "Title"));
        this.ghostTraits   = ghostTraits;
        this.favouriteRoom = LevelController.instance.rooms[ghostTraits.favouriteRoomID];
        LevelController.instance.currentGhost = this.ghost;
        GameController.instance.OnGhostSpawned.Invoke();
        if (PhotonNetwork.isMasterClient)
        {
            EvidenceController.instance.SpawnAllGhostTypeEvidence(ghostTraits.ghostType);
        }
    }
示例#19
0
 // Token: 0x06000A41 RID: 2625 RVA: 0x0003F514 File Offset: 0x0003D714
 public void AddButton(InventoryItem item)
 {
     if (item.canChangeAmount && item.totalAmount < item.maxAmount)
     {
         int i = 0;
         while (i < item.players.Count)
         {
             if (item.players[i].isLocalPlayer)
             {
                 if (FileBasedPrefs.GetInt(item.itemName + "Inventory", 0) > item.players[i].currentAmount)
                 {
                     item.canChangeAmount = false;
                     item.ChangeTotalAmount(PhotonNetwork.player.ID, 1);
                     return;
                 }
                 break;
             }
             else
             {
                 i++;
             }
         }
     }
 }
 //! Saves the inventory's contents to .sav file.
 private void SaveDataToFile()
 {
     if (initialized == true)
     {
         if (ID != originalID)
         {
             int originalCount = 0;
             while (originalCount <= 15)
             {
                 FileBasedPrefs.SetString(stateManager.worldName + "inventory" + originalID + "slot" + originalCount + "type", "nothing");
                 FileBasedPrefs.SetInt(stateManager.worldName + "inventory" + originalID + "slot" + originalCount + "amount", 0);
                 originalCount++;
             }
             originalID = ID;
         }
         int count = 0;
         while (count <= 15)
         {
             FileBasedPrefs.SetString(stateManager.worldName + "inventory" + ID + "slot" + count + "type", inventory[count].typeInSlot);
             FileBasedPrefs.SetInt(stateManager.worldName + "inventory" + ID + "slot" + count + "amount", inventory[count].amountInSlot);
             count++;
         }
     }
 }
示例#21
0
        public void check()
        {
            if (first.name == second.name)
            {
                count += 1;
                first.GetComponent <BoxCollider2D> ().enabled  = false;
                second.GetComponent <BoxCollider2D> ().enabled = false;

                SoundManager.Instance.gameSounds[1].Play();

                if (count == 14)
                {
                    Prize.SetActive(true);
                    SteamHandler.instance.SetAch(SteamACH1);
                    if (FileBasedPrefs.HasKey("bigPuzzCount"))
                    {
                        FileBasedPrefs.SetInt("bigPuzzCount", FileBasedPrefs.GetInt("bigPuzzCount") + 1);
                    }
                    else
                    {
                        FileBasedPrefs.SetInt("bigPuzzCount", 1);
                    }
                    Debug.Log(FileBasedPrefs.GetInt("bigPuzzCount"));
                    if (FileBasedPrefs.GetInt("bigPuzzCount") >= 8)
                    {
                        SteamHandler.instance.SetAch(SteamACH);
                    }
                }
                Debug.Log("match");
            }
            else
            {
                StartCoroutine(waitFor3());
                Debug.Log("Notmatch");
            }
        }
示例#22
0
    private static void GetValue <T>(String key, T list, ArrayType arrayType, int vectorNumber, Action <T, byte[]> convert) where T : IList
    {
        if (FileBasedPrefs.HasKey(key))
        {
            var bytes = System.Convert.FromBase64String(FileBasedPrefs.GetString(key));
            if ((bytes.Length - 1) % (vectorNumber * 4) != 0)
            {
                Debug.LogError("Corrupt preference file for " + key);
                return;
            }
            if ((ArrayType)bytes[0] != arrayType)
            {
                Debug.LogError(key + " is not a " + arrayType.ToString() + " array");
                return;
            }
            Initialize();

            var end = (bytes.Length - 1) / (vectorNumber * 4);
            for (var i = 0; i < end; i++)
            {
                convert(list, bytes);
            }
        }
    }
示例#23
0
    // Token: 0x06000C6A RID: 3178 RVA: 0x0004EA88 File Offset: 0x0004CC88
    public static void CheckExp(bool isDead)
    {
        int num  = 0;
        int @int = FileBasedPrefs.GetInt("myTotalExp", 0);

        if (LevelController.instance.type == LevelController.levelType.small)
        {
            num += PlayerPrefs.GetInt("MainMission") * 25;
        }
        else if (LevelController.instance.type == LevelController.levelType.medium)
        {
            num += PlayerPrefs.GetInt("MainMission") * 35;
        }
        else if (LevelController.instance.type == LevelController.levelType.large)
        {
            num += PlayerPrefs.GetInt("MainMission") * 45;
        }
        num += PlayerPrefs.GetInt("SideMission1") * 20;
        num += PlayerPrefs.GetInt("SideMission2") * 20;
        num += PlayerPrefs.GetInt("SideMission3") * 20;
        num += PlayerPrefs.GetInt("DNAMission") * 15 * (int)(LevelController.instance.type + 1);
        if (isDead)
        {
            num /= 2;
        }
        else if (GameController.instance.levelDifficulty == Contract.LevelDifficulty.Intermediate)
        {
            num = (int)((double)num * 1.5);
        }
        else if (GameController.instance.levelDifficulty == Contract.LevelDifficulty.Professional)
        {
            num *= 2;
        }
        FileBasedPrefs.SetInt("totalExp", num);
        FileBasedPrefs.SetInt("myTotalExp", @int + num);
    }
示例#24
0
 // Update is called once per frame
 void Update()
 {
     if (check())
     {
         prize.SetActive(true);
         if (!FileBasedPrefs.HasKey("safePrefset"))
         {
             FileBasedPrefs.SetInt("safePrefset", 1);
             if (FileBasedPrefs.HasKey("bigPuzzCount"))
             {
                 FileBasedPrefs.SetInt("bigPuzzCount", FileBasedPrefs.GetInt("bigPuzzCount") + 1);
             }
             else
             {
                 FileBasedPrefs.SetInt("bigPuzzCount", 1);
             }
             Debug.Log(FileBasedPrefs.GetInt("bigPuzzCount"));
             if (FileBasedPrefs.GetInt("bigPuzzCount") >= 8)
             {
                 SteamHandler.instance.SetAch(SteamACH);
             }
         }
     }
 }
    //! Handles saving world and exiting to the main menu.
    public static IEnumerator Save()
    {
        float f = 0;

        while (f < 6000)
        {
            f++;
            if (GameObject.Find("GameManager").GetComponent <GameManager>().blocksCombined == false)
            {
                if (GameObject.Find("GameManager").GetComponent <GameManager>().dataSaveRequested == false)
                {
                    if (GameObject.Find("GameManager").GetComponent <StateManager>().saving == false)
                    {
                        Debug.Log("Game saved to " + FileBasedPrefs.GetSaveFilePath());
                        Debug.Log("Creating backup...");
                        string fileName        = GameObject.Find("GameManager").GetComponent <StateManager>().worldName;
                        string destinationPath = Path.Combine(Application.persistentDataPath, "SaveData/" + fileName + ".bak");
                        File.Copy(FileBasedPrefs.GetSaveFilePath(), destinationPath, true);
                        Debug.Log("Backup saved to " + destinationPath);
                        if (GameObject.Find("Player").GetComponent <PlayerController>().exiting == true)
                        {
                            Debug.Log("Loading main menu...");
                            FileBasedPrefs.initialized = false;
                            FileBasedPrefs._latestData = null;
                            SceneManager.LoadScene(0);
                        }
                        else
                        {
                            break;
                        }
                    }
                }
            }
            yield return(new WaitForSeconds(0.1f));
        }
    }
        private void ShitIStoleFromYude2000()
        {
            string[] allitems = new string[]
            {
                "BasementKey",
                "CarKey",
                "GarageKey",
                "MainKey",
                "Blacklight Flashlight",
                "Glowstick",
                "Flashlight",
                "StrongFlashlight",
                "EMF Reader",
                "EVP Recorder",
                "Thermometer",
                "IR Light Sensor",
                "Motion Sensor",
                "SoundSensor",
                "Ghost Writing Book",
                "Parabolic Microphone",
                "DSLRCamera",
                "Tripod",
                "Head Mounted Camera",
                "Candle",
                "Crucifix",
                "Lighter",
                "SaltShaker",
                "Bone",
                "Ouija board",
                "PainKillers",
                "WhiteSage",
                "Hellephant",
                "Hanging Body",
                "monsterprefab",
                "WiccanAltar",
                "ZomBear",
                "ZomBunny",
                "ButcherKnife",
                "HumanSkull",
                "VHS Tape",
                "TarotCardBox",
                "VoodooDoll",
                "Bug",
                "GhostOrb",
                "EMF Spot",
                "Footstep",
                "PhotoPaper",
                "Noise Spot",
                "SaltSpot",
                "SanitySoundSpot",
                "TornCloth",
                "Camera",
                "Walkie Talkie",
                "BoxFlashPrefab",
            };

            if (!PhotonNetwork.InRoom)
            {
                GUI.Label(new Rect(720f, 0f, 200f, 20f), "Custom Room Creator:");
                this.serverName  = GUI.TextArea(new Rect(720f, 25f, 200f, 20f), this.serverName);
                this.serverSlots = GUI.HorizontalSlider(new Rect(720f, 50f, 200f, 20f), (float)((int)this.serverSlots), 4f, 90f);
                GUI.Label(new Rect(720f, 65f, 200f, 20f), "Slots: " + ((int)this.serverSlots).ToString());
                if (GUI.Toggle(new Rect(720f, 80f, 200f, 20f), this.isPrivateServer, "Private Room") != this.isPrivateServer)
                {
                    this.isPrivateServer = !isPrivateServer;
                }
                if (GUI.Button(new Rect(720f, 105f, 200f, 20f), "Create Custom Room"))
                {
                    if (this.isPrivateServer)
                    {
                        PlayerPrefs.SetInt("isPublicServer", 0);
                        RoomOptions roomOptions = new RoomOptions
                        {
                            IsOpen     = true,
                            IsVisible  = false,
                            MaxPlayers = Convert.ToByte((int)this.serverSlots),
                            PlayerTtl  = 2000
                        };
                        PhotonNetwork.CreateRoom(UnityEngine.Random.Range(0, 999999).ToString("000000"), roomOptions, TypedLobby.Default);
                    }
                    if (!this.isPrivateServer)
                    {
                        PlayerPrefs.SetInt("isPublicServer", 1);
                        RoomOptions roomOptions2 = new RoomOptions
                        {
                            IsOpen     = true,
                            IsVisible  = true,
                            MaxPlayers = Convert.ToByte((int)this.serverSlots),
                            PlayerTtl  = 2000
                        };
                        PhotonNetwork.CreateRoom(this.serverName + "#" + UnityEngine.Random.Range(0, 999999).ToString("000000"), roomOptions2, TypedLobby.Default);
                    }
                }
            }
            if (Main.levelController != null)
            {
                if (GUI.Button(new Rect(520f, 120f, 200f, 20f), "Random Event") && Main.ghostAI != null)
                {
                    Main.ghostAI.field_Public_GhostActivity_0.InteractWithARandomDoor();
                    Main.ghostAI.field_Public_GhostActivity_0.InteractWithARandomProp();
                    Main.ghostAI.field_Public_GhostActivity_0.Interact();
                    Main.ghostAI.RandomEvent();
                }

                //if (GUI.Button(new Rect(520f, 120f, 200f, 20f), "Sound"))
                //{
                //    Main.ghostAudio.PlaySound(1, false, false);
                //    Main.ghostAudio.PlaySound(0, false, false);

                //    Main.ghostInteraction.GetComponent<PhotonView>().RPC("SpawnFootstepNetworked", 0, new Il2CppSystem.Object[]
                //    {
                //        ghostAI.transform.position,
                //        ghostAI.transform.rotation,
                //        new Il2CppSystem.Int32(){ m_value = UnityEngine.Random.Range(0, 3) }.BoxIl2CppObject()
                //    });
                //}

                if (GUI.Button(new Rect(520f, 145f, 200f, 20f), "Wander"))
                {
                    Main.ghostAI.field_Public_Boolean_6 = true;
                    Main.ghostAI.field_Public_Animator_0.SetBool("isIdle", false);
                    Vector3    destination = Vector3.zero;
                    NavMeshHit navMeshHit;
                    if (NavMesh.SamplePosition(UnityEngine.Random.insideUnitSphere * 3f + Main.ghostAI.transform.position, out navMeshHit, 3f, 1))
                    {
                        destination = navMeshHit.position;
                    }
                    Main.ghostAI.field_Public_NavMeshAgent_0.destination = destination;
                    Main.ghostAI.ChangeState((GhostAI.EnumNPublicSealedvaidwahufalidothfuapUnique) 1, null, null);
                    Main.ghostAI.field_Public_PhotonView_0.RPC("Hunting", 0, new Il2CppSystem.Object[]
                    {
                        new Il2CppSystem.Boolean().BoxIl2CppObject()
                    });
                    Main.ghostAI.field_Public_PhotonView_0.RPC("SyncChasingPlayer", 0, new Il2CppSystem.Object[]
                    {
                        new Il2CppSystem.Boolean().BoxIl2CppObject()
                    });
                }
                if (GUI.Button(new Rect(520f, 170f, 200f, 20f), "Hunt"))
                {
                    SetupPhaseController.field_Public_Static_SetupPhaseController_0.field_Public_Boolean_0 = false;
                    Main.ghostAI.field_Public_Boolean_4 = true;
                    Main.ghostAI.field_Public_Boolean_2 = true;
                    Main.ghostAI.field_Public_Animator_0.SetBool("isIdle", false);
                    Main.ghostAI.field_Public_Animator_0.SetInteger("WalkType", 1);
                    Main.ghostAI.field_Public_NavMeshAgent_0.speed = Main.ghostAI.field_Public_Single_0;
                    Main.ghostAI.field_Public_GhostInteraction_0.CreateAppearedEMF(Main.ghostAI.transform.position);
                    Vector3 destination2 = Vector3.zero;
                    float   num          = UnityEngine.Random.Range(2f, 15f);

                    NavMeshHit navMeshHit2;

                    if (NavMesh.SamplePosition(UnityEngine.Random.insideUnitSphere * num + Main.ghostAI.transform.position, out navMeshHit2, num, 1))
                    {
                        destination2 = navMeshHit2.position;
                    }
                    else
                    {
                        destination2 = Vector3.zero;
                    }
                    Main.ghostAI.field_Public_NavMeshAgent_0.SetDestination(destination2);
                    SetupPhaseController.field_Public_Static_SetupPhaseController_0.ForceEnterHuntingPhase();
                    Main.ghostAI.ChangeState((GhostAI.EnumNPublicSealedvaidwahufalidothfuapUnique) 2, null, null);
                    Main.ghostAI.field_Public_PhotonView_0.RPC("Hunting", 0, new Il2CppSystem.Object[]
                    {
                        new Il2CppSystem.Boolean()
                        {
                            m_value = true
                        }.BoxIl2CppObject()
                    });
                    Main.ghostAI.field_Public_PhotonView_0.RPC("SyncChasingPlayer", 0, new Il2CppSystem.Object[]
                    {
                        new Il2CppSystem.Boolean()
                        {
                            m_value = true
                        }.BoxIl2CppObject()
                    });
                }
                if (GUI.Button(new Rect(520f, 195f, 200f, 20f), "Idle"))
                {
                    Main.ghostAI.field_Public_Animator_0.SetInteger("IdleNumber", UnityEngine.Random.Range(0, 2));
                    Main.ghostAI.field_Public_Animator_0.SetBool("isIdle", true);
                    Main.ghostAI.UnAppear(false);
                    Main.ghostAI.field_Public_GhostAudio_0.TurnOnOrOffAppearSource(false);
                    Main.ghostAI.field_Public_GhostAudio_0.PlayOrStopAppearSource(false);
                    Main.ghostAI.ChangeState(0, null, null);
                    Main.ghostAI.field_Public_PhotonView_0.RPC("Hunting", 0, new Il2CppSystem.Object[]
                    {
                        new Il2CppSystem.Boolean().BoxIl2CppObject()
                    });
                    Main.ghostAI.field_Public_PhotonView_0.RPC("SyncChasingPlayer", 0, new Il2CppSystem.Object[]
                    {
                        new Il2CppSystem.Boolean().BoxIl2CppObject()
                    });
                }
                Il2CppSystem.Int32 appearRand = new Il2CppSystem.Int32();

                appearRand.m_value = UnityEngine.Random.Range(0, 3);

                if (GUI.Button(new Rect(520f, 220f, 200f, 20f), "Appear"))
                {
                    Main.ghostAI.field_Public_PhotonView_0.RPC("MakeGhostAppear", 0, new Il2CppSystem.Object[]
                    {
                        new Il2CppSystem.Boolean()
                        {
                            m_value = true
                        }.BoxIl2CppObject(),
                        new Il2CppSystem.Int32()
                        {
                            m_value = UnityEngine.Random.Range(0, 3)
                        }.BoxIl2CppObject()
                    });
                }
                if (GUI.Button(new Rect(520f, 245f, 200f, 20f), "Unappear"))
                {
                    Main.ghostAI.field_Public_PhotonView_0.RPC("MakeGhostAppear", 0, new Il2CppSystem.Object[]
                    {
                        new Il2CppSystem.Boolean().BoxIl2CppObject(),
                        new Il2CppSystem.Int32()
                        {
                            m_value = UnityEngine.Random.Range(0, 3)
                        }.BoxIl2CppObject()
                    });
                }
                if (GUI.Toggle(new Rect(1120f, 325f, 200f, 20f), this.showItemList, "Show Item Spawner") != this.showItemList)
                {
                    this.showItemList = !this.showItemList;
                }

                if (this.showItemList)
                {
                    GUI.Label(new Rect(520f, 225f, 200f, 20f), "Item Spawner:");
                    this.scrollViewVector = GUI.BeginScrollView(new Rect(this.dropDownRect2.x - 100f, this.dropDownRect2.y + 25f, this.dropDownRect2.width, this.dropDownRect2.height), this.scrollViewVector, new Rect(0f, 0f, this.dropDownRect2.width, Mathf.Max(this.dropDownRect2.height, (float)(allitems.Length * 25))));
                    GUI.Box(new Rect(0f, 0f, this.dropDownRect2.width, Mathf.Max(this.dropDownRect2.height, (float)(allitems.Length * 25))), "");
                    for (int l = 0; l < allitems.Length; l++)
                    {
                        if (GUI.Button(new Rect(0f, (float)(l * 25), this.dropDownRect2.height, 25f), ""))
                        {
                            this.selecteditem = l;
                            if (PhotonNetwork.InRoom)
                            {
                                MyPlayer = GetLocalPlayer();
                                MelonLogger.Log(allitems[this.selecteditem].ToString());
                                PhotonNetwork.Instantiate(allitems[this.selecteditem], MyPlayer.transform.position, Quaternion.identity, 0, null);
                            }
                        }
                        GUI.Label(new Rect(5f, (float)(l * 25), this.dropDownRect2.height, 25f), allitems[l]);
                    }
                    GUI.EndScrollView();
                }

                GUI.Label(new Rect(920f, 295f, 200f, 20f), "ESP:");
                if (GUI.Toggle(new Rect(920f, 320f, 200f, 20f), this.GhostESP, "Ghost") != this.GhostESP)
                {
                    this.GhostESP = !this.GhostESP;
                }
                if (GUI.Toggle(new Rect(920f, 370f, 200f, 20f), this.PlayerESP, "Player") != this.PlayerESP)
                {
                    this.PlayerESP = !this.PlayerESP;
                }
                if (GUI.Toggle(new Rect(920f, 395f, 200f, 20f), this.OuijaESP, "Ouija Board") != this.OuijaESP)
                {
                    this.OuijaESP = !this.OuijaESP;
                }
                if (GUI.Toggle(new Rect(920f, 420f, 200f, 20f), this.KeyESP, "Key") != this.KeyESP)
                {
                    this.KeyESP = !this.KeyESP;
                }
                if (GUI.Toggle(new Rect(920f, 445f, 200f, 20f), this.EvidenceESP, "Evidence") != this.EvidenceESP)
                {
                    this.EvidenceESP = !this.EvidenceESP;
                }

                if (GUI.Toggle(new Rect(1120f, 300f, 200f, 20f), this.ShowInfoGhost, "Show Ghost Info") != this.ShowInfoGhost)
                {
                    this.ShowInfoGhost = !this.ShowInfoGhost;
                }
                if (GUI.Toggle(new Rect(1120f, 250f, 200f, 20f), this.ShowInfoPlayer, "Show Player Info") != this.ShowInfoPlayer)
                {
                    this.ShowInfoPlayer = !this.ShowInfoPlayer;
                }
            }
            if (Main.levelController == null)
            {
                GUI.SetNextControlName("changename");
                this.Name = GUI.TextArea(new Rect(320f, 25f, 200f, 20f), this.Name);
                if (GUI.Button(new Rect(320f, 45f, 200f, 20f), "Change Name"))
                {
                    GUI.FocusControl("changename");
                    PhotonNetwork.NickName = this.Name;
                }

                if (GUI.Button(new Rect(320f, 145f, 200f, 20f), "Force Start"))
                {
                    Main.serverManager.StartGame();
                }

                if (GUI.Button(new Rect(520f, 50f, 200f, 20f), "Add 100$"))
                {
                    FileBasedPrefs.SetInt("PlayersMoney", FileBasedPrefs.GetInt("PlayersMoney", 0) + 100);
                }
                if (GUI.Button(new Rect(520f, 75f, 200f, 20f), "Add 1 Level"))
                {
                    FileBasedPrefs.SetInt("myTotalExp", FileBasedPrefs.GetInt("myTotalExp", 0) + 100);
                }

                //GUI.Label(new Rect(920f, 0f, 200f, 20f), "Join Room:");
                //this.roomName = GUI.TextArea(new Rect(920f, 25f, 200f, 20f), this.roomName);
                //this.steamID = GUI.TextArea(new Rect(920f, 50f, 200f, 20f), this.steamID);
                //if (GUI.Button(new Rect(920f, 75f, 200f, 20f), "Join Room by Name"))
                //{
                //    PhotonNetwork.JoinRoom(this.roomName);
                //}
                //if (GUI.Button(new Rect(920f, 100f, 200f, 20f), "Join Room by ID"))
                //{
                //    object[] FriendIDList;

                //    bool test = PhotonNetwork.FindFriends(new string[]
                //    {
                //            this.steamID
                //    });
                //    MelonLogger.Log("steamID = " + steamID);
                //    //foreach (FriendInfo friendInfo in PhotonNetwork.Friends)
                //    //{
                //    //PhotonNetwork.JoinRoom(friendInfo.Room);
                //    //}
                //}
            }
        }
示例#27
0
 private void OnMouseDown()
 {
     FileBasedPrefs.SetString(gameObject.name + "1", "showed_once");
     gameObject.SetActive(false);
 }
示例#28
0
 public static void BuyFix()
 {
     FileBasedPrefs.SetInt("PlayersMoney", 999999);
 }
示例#29
0
        void OnEnable()
        {
            int counter = 0;

            foreach (var pzzItem in PuzzlePieces)
            {
                foreach (var invItem in bothash.InventoryManager.instance.InventorySO.myInventory)
                {
                    if (pzzItem.name == invItem.puzzlePieceName)
                    {
                        counter++;
                    }
                }
            }

            if (touched() || counter >= PuzzlePieces.Count)
            {
                SoundManager.Instance.PlayMyMusic("Puzzle");
                blocker.SetActive(false);
                List <string> tmp = new List <string>();

                foreach (var pzzItem in PuzzlePieces)
                {
                    foreach (var invItem in bothash.InventoryManager.instance.InventorySO.myInventory)
                    {
                        if (pzzItem.name == invItem.puzzlePieceName)
                        {
                            tmp.Add(invItem.itemName);
                        }
                    }

                    pzzItem.GetComponent <SpriteRenderer>().enabled = true;
                }

                foreach (var itemNAme in tmp)
                {
                    Destroy(InventoryManager.instance.slotItemDict[itemNAme]);
                    InventoryManager.instance.removeFromInventory(InventoryManager.instance.slotItemDict[itemNAme]);
                }

                //make sprite renderer on and delete them from inventory
            }
            else
            {
                blocker.SetActive(true);
            }

            if (Pcount > 0)
            {
                blankPos = 15;
                blankTile.transform.position = blankPosOrg.transform.position;
                for (int i = 0; i < tilesPosOrg.Count; i++)
                {
                    tilesPos.Add(tilesPosOrg[i]);
                }
            }
            else
            {
                for (int i = 0; i < tilesPos.Count; i++)
                {
                    tilesPosOrg.Add(tilesPos[i]);
                }
            }
            blankPos = 15;
            int pos;

            for (int i = 0; i < tiles.Length; i++)
            {
                pos = UnityEngine.Random.Range(0, tilesPos.Count);
                tiles[i].transform.localPosition = tilesPos[pos].position;
                posAfterRandom[i] = tilesPosOrg.IndexOf(tilesPos[pos]);
                tilesPos.RemoveAt(pos);
            }
            Pcount++;
            if (FileBasedPrefs.HasKey("PuzzlePieces"))
            {
                puzzleBox.SetActive(false);
            }
        }
示例#30
0
 // Token: 0x060007DE RID: 2014 RVA: 0x0002EEB0 File Offset: 0x0002D0B0
 public void Awake()
 {
     if (!FileBasedPrefs.HasKey("myTotalExp"))
     {
         FileBasedPrefs.SetInt("myTotalExp", PlayerPrefs.GetInt("myTotalExp"));
     }
     if (!FileBasedPrefs.HasKey("PlayersMoney"))
     {
         FileBasedPrefs.SetInt("PlayersMoney", PlayerPrefs.GetInt("PlayersMoney"));
     }
     if (!FileBasedPrefs.HasKey("EMFReaderInventory"))
     {
         FileBasedPrefs.SetInt("EMFReaderInventory", PlayerPrefs.GetInt("EMFReaderInventory"));
     }
     if (!FileBasedPrefs.HasKey("FlashlightInventory"))
     {
         FileBasedPrefs.SetInt("FlashlightInventory", PlayerPrefs.GetInt("FlashlightInventory"));
     }
     if (!FileBasedPrefs.HasKey("CameraInventory"))
     {
         FileBasedPrefs.SetInt("CameraInventory", PlayerPrefs.GetInt("CameraInventory"));
     }
     if (!FileBasedPrefs.HasKey("LighterInventory"))
     {
         FileBasedPrefs.SetInt("LighterInventory", PlayerPrefs.GetInt("LighterInventory"));
     }
     if (!FileBasedPrefs.HasKey("CandleInventory"))
     {
         FileBasedPrefs.SetInt("CandleInventory", PlayerPrefs.GetInt("CandleInventory"));
     }
     if (!FileBasedPrefs.HasKey("UVFlashlightInventory"))
     {
         FileBasedPrefs.SetInt("UVFlashlightInventory", PlayerPrefs.GetInt("UVFlashlightInventory"));
     }
     if (!FileBasedPrefs.HasKey("CrucifixInventory"))
     {
         FileBasedPrefs.SetInt("CrucifixInventory", PlayerPrefs.GetInt("CrucifixInventory"));
     }
     if (!FileBasedPrefs.HasKey("DSLRCameraInventory"))
     {
         FileBasedPrefs.SetInt("DSLRCameraInventory", PlayerPrefs.GetInt("DSLRCameraInventory"));
     }
     if (!FileBasedPrefs.HasKey("EVPRecorderInventory"))
     {
         FileBasedPrefs.SetInt("EVPRecorderInventory", PlayerPrefs.GetInt("EVPRecorderInventory"));
     }
     if (!FileBasedPrefs.HasKey("SaltInventory"))
     {
         FileBasedPrefs.SetInt("SaltInventory", PlayerPrefs.GetInt("SaltInventory"));
     }
     if (!FileBasedPrefs.HasKey("SageInventory"))
     {
         FileBasedPrefs.SetInt("SageInventory", PlayerPrefs.GetInt("SageInventory"));
     }
     if (!FileBasedPrefs.HasKey("TripodInventory"))
     {
         FileBasedPrefs.SetInt("TripodInventory", PlayerPrefs.GetInt("TripodInventory"));
     }
     if (!FileBasedPrefs.HasKey("StrongFlashlightInventory"))
     {
         FileBasedPrefs.SetInt("StrongFlashlightInventory", PlayerPrefs.GetInt("StrongFlashlightInventory"));
     }
     if (!FileBasedPrefs.HasKey("MotionSensorInventory"))
     {
         FileBasedPrefs.SetInt("MotionSensorInventory", PlayerPrefs.GetInt("MotionSensorInventory"));
     }
     if (!FileBasedPrefs.HasKey("SoundSensorInventory"))
     {
         FileBasedPrefs.SetInt("SoundSensorInventory", PlayerPrefs.GetInt("SoundSensorInventory"));
     }
     if (!FileBasedPrefs.HasKey("SanityPillsInventory"))
     {
         FileBasedPrefs.SetInt("SanityPillsInventory", PlayerPrefs.GetInt("SanityPillsInventory"));
     }
     if (!FileBasedPrefs.HasKey("ThermometerInventory"))
     {
         FileBasedPrefs.SetInt("ThermometerInventory", PlayerPrefs.GetInt("ThermometerInventory"));
     }
     if (!FileBasedPrefs.HasKey("GhostWritingBookInventory"))
     {
         FileBasedPrefs.SetInt("GhostWritingBookInventory", PlayerPrefs.GetInt("GhostWritingBookInventory"));
     }
     if (!FileBasedPrefs.HasKey("IRLightSensorInventory"))
     {
         FileBasedPrefs.SetInt("IRLightSensorInventory", PlayerPrefs.GetInt("IRLightSensorInventory"));
     }
     if (!FileBasedPrefs.HasKey("ParabolicMicrophoneInventory"))
     {
         FileBasedPrefs.SetInt("ParabolicMicrophoneInventory", PlayerPrefs.GetInt("ParabolicMicrophoneInventory"));
     }
     if (!FileBasedPrefs.HasKey("GlowstickInventory"))
     {
         FileBasedPrefs.SetInt("GlowstickInventory", PlayerPrefs.GetInt("GlowstickInventory"));
     }
     if (!FileBasedPrefs.HasKey("HeadMountedCameraInventory"))
     {
         FileBasedPrefs.SetInt("HeadMountedCameraInventory", PlayerPrefs.GetInt("HeadMountedCameraInventory"));
     }
     if (!FileBasedPrefs.HasKey("PlayerDied"))
     {
         FileBasedPrefs.SetInt("PlayerDied", PlayerPrefs.GetInt("PlayerDied"));
     }
     if (!FileBasedPrefs.HasKey("MissionStatus"))
     {
         FileBasedPrefs.SetInt("MissionStatus", PlayerPrefs.GetInt("MissionStatus"));
     }
     if (!FileBasedPrefs.HasKey("LevelDifficulty"))
     {
         FileBasedPrefs.SetInt("LevelDifficulty", PlayerPrefs.GetInt("LevelDifficulty"));
     }
     if (!FileBasedPrefs.HasKey("completedTraining"))
     {
         FileBasedPrefs.SetInt("completedTraining", PlayerPrefs.GetInt("completedTraining"));
     }
     PlayerPrefs.DeleteKey("myTotalExp");
     PlayerPrefs.DeleteKey("PlayersMoney");
     PlayerPrefs.DeleteKey("EMFReaderInventory");
     PlayerPrefs.DeleteKey("FlashlightInventory");
     PlayerPrefs.DeleteKey("CameraInventory");
     PlayerPrefs.DeleteKey("LighterInventory");
     PlayerPrefs.DeleteKey("CandleInventory");
     PlayerPrefs.DeleteKey("UVFlashlightInventory");
     PlayerPrefs.DeleteKey("CrucifixInventory");
     PlayerPrefs.DeleteKey("DSLRCameraInventory");
     PlayerPrefs.DeleteKey("EVPRecorderInventory");
     PlayerPrefs.DeleteKey("SaltInventory");
     PlayerPrefs.DeleteKey("SageInventory");
     PlayerPrefs.DeleteKey("TripodInventory");
     PlayerPrefs.DeleteKey("StrongFlashlightInventory");
     PlayerPrefs.DeleteKey("MotionSensorInventory");
     PlayerPrefs.DeleteKey("SoundSensorInventory");
     PlayerPrefs.DeleteKey("SanityPillsInventory");
     PlayerPrefs.DeleteKey("ThermometerInventory");
     PlayerPrefs.DeleteKey("GhostWritingBookInventory");
     PlayerPrefs.DeleteKey("IRLightSensorInventory");
     PlayerPrefs.DeleteKey("ParabolicMicrophoneInventory");
     PlayerPrefs.DeleteKey("GlowstickInventory");
     PlayerPrefs.DeleteKey("HeadMountedCameraInventory");
     this.SetDefaultValues();
 }