Beispiel #1
0
 private void Awake()
 {
     bl_Inventory       = m_GameManager.inventoryScript;
     bl_ItemSwitcher    = GetComponentInChildren <ItemSwitcher>(true);
     bl_InteractManager = GetComponent <InteractManager>();
     bl_PlayerFunctions = GetComponent <PlayerFunctions>();
 }
Beispiel #2
0
    private void Start()
    {
        if (GetComponent <InteractManager>() && GetComponent <PlayerFunctions>())
        {
            inputManager = InputController.Instance;
            gameManager  = HFPS_GameManager.Instance;
            floatingItem = FloatingIconManager.Instance;
            interact     = GetComponent <InteractManager>();
            pfunc        = GetComponent <PlayerFunctions>();
            paperUI      = gameManager.PaperTextUI;
            paperText    = gameManager.PaperReadText;
        }
        else
        {
            Debug.LogError("Missing one or more scripts in " + gameObject.name);
            return;
        }

        if (examineLight)
        {
            examineLight.enabled = false;
        }

        delay              = transform.root.gameObject.GetComponentInChildren <DelayEffect>();
        PlayerCam          = ScriptManager.Instance.MainCamera;
        ArmsCam            = ScriptManager.Instance.ArmsCamera;
        DefaultMainCamMask = ScriptManager.Instance.MainCamera.cullingMask;
        DefaultArmsCamMask = ArmsCam.cullingMask;
        pickupRange        = interact.RaycastRange;
    }
    public void Start()
    {
        Debug.Log("Starting");
        //one time run to add dictionary entries of cardMechanic enums and text descriptions
        CardTagManager.CardTagDictionaryInitialize();

        //initial caching of player stats
        playerFunctions = player.GetComponent <PlayerFunctions>();

        //for just copying the default energy and draws from playerFunctions
        //defaultEnergy = player.GetComponent<PlayerFunctions>().defaultEnergy;
        //Draw = player.GetComponent<PlayerFunctions>().defaultDraw;

        //DrawHand();
        ////sends default energy to updater
        //EnergyUpdater(defaultEnergy);
        //DeckUpdater();

        d_StartTurn += StartTurn;
        d_StartTurn += enemyHolder.GetComponent <EnemyAIManager>().EnemyStart;
        d_StartTurn += player.GetComponent <PlayerFunctions>().PlayerTurn;
        //d_StartTurn += Player.GetComponent<AbilityManager>().EnableAbilities;
        //d_StartTurn += Player.GetComponent<PlayerFunctions>().AlterPlayerCreativity;
        //d_StartTurn += playerFunctions.StartTurnUpdates;
        d_StartTurn();
    }
Beispiel #4
0
    private void RPC_MasterDealCardToPlayer(string rank, string suit, string playerId)
    {
        CardSerializer datas = new CardSerializer(rank, suit);

        Card card = new Card(datas);

        PlayerCards playerCards = PlayerFunctions.GetPlayer(playerId, dataManager.GetPlayerFromPlayerCards()); //GetPlayer(playerId);

        playerCards.AddCards(card);

        Debug.Log("Using this RPC");

        // Set next turn
        playerCards.UnSetTurn();

        Player nextPlayer = playerCards.player.GetNext();

        PlayerCards nextPlayerPlayerCards = PlayerFunctions.GetPlayer(nextPlayer.NickName, dataManager.GetPlayerFromPlayerCards());

        nextPlayerPlayerCards.SetToTurn();
        // End set turn

        card = PlayerFunctions.GetSameCard(card, GetAllCards());

        dataManager.RemoveCardsFromAllCards(card);

        CardAnimator.GetComponent <CardAnimator>().AddCardToPlayerDeck(card, playerId);

        // show animation for market
        CardAnimator.GetComponent <CardAnimator>().ShowNextPlayerGeneric(nextPlayer.NickName + " plays next");
    }
Beispiel #5
0
    private void RPC_PlayCard(string rank, string suit, string playerId)
    {
        CardSerializer datas = new CardSerializer(rank, suit);

        Card card = new Card(datas);

        PlayerCards playerCards = PlayerFunctions.GetPlayer(playerId, dataManager.GetPlayerFromPlayerCards());

        List <Card> allCards = playerCards.GetAllCards();

        // Set next turn
        playerCards.UnSetTurn();

        Player nextPlayer = playerCards.player.GetNext();

        PlayerCards nextPlayerPlayerCards = PlayerFunctions.GetPlayer(nextPlayer.NickName, dataManager.GetPlayerFromPlayerCards());

        card = PlayerFunctions.GetSameCard(card, allCards);

        dataManager.AddCardsToPlayingDeck(card);

        playerCards.RemoveCards(card);

        CardAnimator.GetComponent <CardAnimator>().AddCardtoPlayingDeck(card, playerId);

        CarryCardActionAsync(card, playerCards.player);
    }
 private void Awake()
 {
     delay        = gameObject.transform.GetChild(0).GetChild(1).GetChild(0).GetChild(0).gameObject.GetComponent <DelayEffect>();
     interact     = GetComponent <InteractManager>();
     inputManager = GetComponent <ScriptManager>().GetScript <InputController>();
     gameManager  = GetComponent <ScriptManager>().GetScript <HFPS_GameManager>();
     pfunc        = GetComponent <PlayerFunctions>();
     playerCam    = Camera.main;
 }
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == GameTags.Player)
        {
            PlayerFunctions pFunc = other.gameObject.GetComponent <PlayerFunctions>();

            pFunc.CheckPoint = gameObject;
            pFunc.IncrementCheckpointCounter(gameObject);
        }
    }
Beispiel #8
0
 private void Awake()
 {
     delay        = gameObject.transform.GetChild(0).GetChild(1).GetChild(0).GetChild(0).gameObject.GetComponent <DelayEffect>();
     interact     = GetComponent <InteractManager>();
     inputManager = InputController.Instance;
     gameManager  = HFPS_GameManager.Instance;
     pfunc        = GetComponent <PlayerFunctions>();
     playerCam    = ScriptManager.Instance.MainCamera;
     PickupRange  = interact.RaycastRange;
 }
Beispiel #9
0
    private void RPC_SetPlayinCard(string rank, string suit)
    {
        CardSerializer datas = new CardSerializer(rank, suit);

        Card card = new Card(datas);

        dataManager.AddCardsToPlayingDeck(card);

        card = PlayerFunctions.GetSameCard(card, GetAllCards());

        dataManager.RemoveCardsFromAllCards(card);
    }
Beispiel #10
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == GameTags.Player)
        {
            PlayerFunctions playerFunctions = other.gameObject.GetComponent <PlayerFunctions>();

            if (playerFunctions.CheckpointCounter == checkpointManager.AmountOfCheckPoints)
            {
                playerFunctions.IncrementLap();
                playerFunctions.CheckPoint = gameObject;
            }
        }
    }
Beispiel #11
0
    private void RPC_DealCardToPlayer(string rank, string suit, string playerId)
    {
        CardSerializer datas = new CardSerializer(rank, suit);

        PlayerCards playerCards = PlayerFunctions.GetPlayer(playerId, GetAllPlayerCards());

        Card card = new Card(datas);

        playerCards.AddCards(card);

        card = PlayerFunctions.GetSameCard(card, playerCards.GetAllCards());

        dataManager.RemoveCardsFromAllCards(card);
    }
Beispiel #12
0
    void Start()
    {
        dataManager = new DataManager();

        photonView = GetComponent <PhotonView>();

        cardFunctions = new CardFunctions();

        RPC_Manager = new RPC_Manager(dataManager, photonView, CardAnimator, cardFunctions);

        dataManager.AllPlayerList = PlayerFunctions.CreatePlayerCardForAllPlayers(dataManager.GetPlayerFromPlayerCards());

        StartGame();
    }
Beispiel #13
0
    public void DealCardFromMarket()
    {
        PlayerCards playerCards = PlayerFunctions.GetPlayer(PhotonNetwork.NickName, dataManager.GetPlayerFromPlayerCards()); //GetPlayer(playerId);

        if (!playerCards.isTurn)
        {
            return;
        }

        playerCards.UnSetTurn();

        RPC_Manager.AskMasterForMarketCard();
        //photonView.RPC("RPC_AskMasterForMarketCard", RpcTarget.MasterClient, PhotonNetwork.LocalPlayer.NickName);
    }
Beispiel #14
0
        private void GameLoop()
        {
            State.GameHasNoWinner = true;
            List <Player> playerWinOrder = new();

            while (State.GameHasNoWinner)
            {
                while (!PlayerFunctions.CheckIfActivePlayerIsInTheGame(State))
                {
                    NextPlayer();
                }
                ShouldTheEngineAskThePlayerIfTheyWantToSave();
                Turn currentTurn = new();

                currentTurn.Roll = State.Players[State.ActivePlayer].Dice.Roll();
                Console.WriteLine($"{State.Players[State.ActivePlayer].Name} rolled a {currentTurn.Roll}");

                if (Movement.AreThereLegalMoves((int)currentTurn.Roll, State))
                {
                    currentTurn = State.Players[State.ActivePlayer].Selector
                                  .Selector(State, currentTurn, Movement.ListLegalMoves(
                                                (int)currentTurn.Roll, State
                                                ));
                    bool pushed = ExecuteTurn(currentTurn);
                    if (!pushed && currentTurn.Roll != 6)
                    {
                        NextPlayer();
                    }
                }
                else
                {
                    Console.WriteLine("No legal moves found, moving to next player");
                    if (currentTurn.Roll != 6)
                    {
                        NextPlayer();
                    }
                }
                State.Turnlist.Add(currentTurn);

                if (State.Players[State.ActivePlayer].Score == 4)
                {
                    playerWinOrder = RemoveActivePlayerFromTheGame(playerWinOrder);

                    State.GameHasNoWinner = false;
                }
            }
            Console.WriteLine($"Player {playerWinOrder[0].Name} won the game!\n~~Congratulations~~");
        }
Beispiel #15
0
    private void RPC_MasterDealCard(string rank, string suit, string playerId)
    {
        CardSerializer datas = new CardSerializer(rank, suit);

        Card card = new Card(datas);

        PlayerCards playerCards = PlayerFunctions.GetPlayer(playerId, dataManager.GetPlayerFromPlayerCards()); //GetPlayer(playerId);

        playerCards.AddCards(card);

        card = PlayerFunctions.GetSameCard(card, GetAllCards());

        dataManager.RemoveCardsFromAllCards(card);

        CardAnimator.GetComponent <CardAnimator>().AddCardToPlayerDeck(card, playerId);
    }
Beispiel #16
0
    private void RPC_PlayCard(string rank, string suit, string playerId)
    {
        CardSerializer datas = new CardSerializer(rank, suit);

        Card card = new Card(datas);

        PlayerCards playerCards = PlayerFunctions.GetPlayer(playerId, dataManager.GetPlayerFromPlayerCards());

        card = PlayerFunctions.GetSameCard(card, playerCards.GetAllCards());

        dataManager.AddCardsToPlayingDeck(card);

        playerCards.RemoveCards(card);

        cardAnimator.AddCardtoPlayingDeck(card, playerId);
    }
        private void OnPlayerChat(PlayerChatEventArgs e)
        {
            //don't check commands
            if (e.RawText.StartsWith(Commands.Specifier))
            {
                return;
            }

            if (!e.Player.HasPermission(SkillPermission))
            {
                return;
            }

            var session = Session.GetOrCreateSession(e.Player);

            if (session.TriggerWordsToSkillDefinitions.Count > 0)
            {
                foreach (var kvp in session.TriggerWordsToSkillDefinitions)
                {
                    var triggerWord = kvp.Key;
                    var definition  = kvp.Value;

                    if (e.RawText.Contains(triggerWord))
                    {
                        //can we use this skill?
                        if (definition.PermissionsToUse != null && !PlayerFunctions.PlayerHasPermission(e.Player, definition.PermissionsToUse))
                        {
                            continue;
                        }

                        if (!session.IsSkillReady(definition.Name))
                        {
                            continue;
                        }

                        if (session.PlayerSkillInfos.TryGetValue(definition.Name, out var playerSkillInfo))
                        {
                            CustomSkillRunner.AddActiveSkill(e.Player, definition, playerSkillInfo.CurrentLevel);
                            return;
                        }
                    }
                }
            }

            //Debug.Print($"Chat: raw: {e.RawText}");
            //Debug.Print($"Chat: formatted: {e.TShockFormattedText}");
        }
Beispiel #18
0
    public void PlayCard(Card card)
    {
        PlayerCards playerCards = PlayerFunctions.GetPlayer(PhotonNetwork.NickName, dataManager.GetPlayerFromPlayerCards()); //GetPlayer(playerId);

        if (!playerCards.isTurn)
        {
            return;
        }

        playerCards.UnSetTurn();

        CardSerializer datas = card.ConvertCardToCardSerializer();

        RPC_Manager.PlayCard(datas);

        //photonView.RPC("RPC_PlayCard", RpcTarget.AllBuffered, datas.Rank, datas.Suit, PhotonNetwork.LocalPlayer.NickName);
    }
Beispiel #19
0
 internal void RunLoadedTurns(List <Turn> executedTurns)
 {
     foreach (Turn t in executedTurns)
     {
         while (!PlayerFunctions.CheckIfActivePlayerIsInTheGame(State))
         {
             NextPlayer();
         }
         bool pushed = ExecuteTurn(t);
         if (!pushed && t.Roll != 6)
         {
             NextPlayer();
         }
         State.Turnlist.Add(t);
     }
     GameLoop();
 }
Beispiel #20
0
        private void SkillSubCommand(TSPlayer player, string skillName, string categoryName = null)
        {
            if (!GetCategoryAndSkill(player, skillName, categoryName, out var category, out var definition))
            {
                return;
            }

            var session = Session.GetOrCreateSession(player);

            if (!session.HasLearned(skillName))
            {
                player.SendErrorMessage($"You have not learned {skillName}.");
                return;
            }

            //are we allowed to use this skill?
            if (definition.PermissionsToUse != null && !PlayerFunctions.PlayerHasPermission(player, definition.PermissionsToUse))
            {
                player.SendInfoMessage($"You are not allowed to use {skillName}.");
                return;
            }

            //do we have enough "funds" to use this skill?
            if (!session.CanAffordCastingSkill(skillName))
            {
                player.SendInfoMessage($"You cannot afford to use {skillName}.");
                return;
            }

            if (!session.IsSkillReady(definition.Name))
            {
                player.SendInfoMessage($"{skillName} is not ready yet.");
                return;
            }

            session.PlayerSkillInfos.TryGetValue(skillName, out var playerSkillInfo);

            var skillAdded = CustomSkillRunner.AddActiveSkill(player, definition, playerSkillInfo.CurrentLevel);

            if (!skillAdded)
            {
                player.SendInfoMessage($"You cannot use {skillName} right now.");
                return;
            }
        }
Beispiel #21
0
    void Start()
    {
        inventory           = scriptManager.GetScript <Inventory>();
        playerFunctions     = scriptManager.GetScript <PlayerFunctions>();
        camFOV              = playerFunctions.NormalFOV;
        muzzleFlash.enabled = false;
        muzzleLight.enabled = false;
        hipPosition         = transform.GetChild(0).localPosition;
        currentMode         = firstMode;
        fireRate            = fireRateFirstMode;
        aiming              = false;

        for (int i = 0; i < Bulletmarks.Length; i++)
        {
            if (!(tags.Count == Bulletmarks.Length))
            {
                tags.Add(Bulletmarks[i].Tag);
            }
        }
    }
Beispiel #22
0
        private void SkillLearnSubCommand(TSPlayer player, string skillName, string categoryName = null)
        {
            if (!GetCategoryAndSkill(player, skillName, categoryName, out var category, out var definition))
            {
                return;
            }

            var session = Session.GetOrCreateSession(player);

            if (session.HasLearned(skillName))
            {
                player.SendInfoMessage($"You have already learned {skillName}.");
                return;
            }

            //can we learn this skill?
            if (definition.PermissionsToLearn != null && !PlayerFunctions.PlayerHasPermission(player, definition.PermissionsToLearn))
            {
                player.SendInfoMessage($"You try, but are unable to learn {skillName}.");
                return;
            }

            if (session.LearnSkill(skillName))
            {
                player.SendInfoMessage($"You have learned {skillName}.");

                //try to run the first OnLevelUp
                try
                {
                    definition.Levels?[0]?.OnLevelUp?.Invoke(player);
                }
                catch (Exception ex)
                {
                    CustomSkillsPlugin.Instance.LogPrint(ex.ToString(), TraceLevel.Error);
                }
            }
            else
            {
                player.SendErrorMessage($"You try to learn {skillName}, but nothing happens. ( This is a bug. )");
            }
        }
Beispiel #23
0
    private void SublimeTeleportMenu()
    {
        List <IMenuItem> teleportMenuItems = new List <IMenuItem>();

        var buttonTeleportToMarker = new MenuButton("Marker");

        buttonTeleportToMarker.Activated += (sender, args) => PlayerFunctions.TeleportToMarker();
        teleportMenuItems.Add(buttonTeleportToMarker);

        Dictionary <string, Vector3> teleportDict = new Dictionary <string, Vector3>()
        {
            { "Michael's House", new Vector3(-852.4f, 160.0f, 65.6f) },
            { "Franklin's House", new Vector3(7.9f, 548.1f, 175.5f) },
            { "Franklin's Aunt", new Vector3(-14.8f, -1454.5f, 30.5f) },
            { "Trevor's Trailer", new Vector3(1985.7f, 3812.2f, 32.2f) },
            { "Airport Entrance", new Vector3(-1034.6f, -2733.6f, 13.8f) },
            { "Airport Field", new Vector3(-1336.0f, -3044.0f, 13.9f) },
            { "Elysian Island", new Vector3(338.2f, -2715.9f, 38.5f) },
            { "Jetsam", new Vector3(760.4f, -2943.2f, 5.8f) },
            { "Strip Club", new Vector3(127.4f, -1307.7f, 29.2f) },
            { "Elburro Heights", new Vector3(1384.0f, -2057.1f, 52.0f) },
            { "Ferris Wheel", new Vector3(-1670.7f, -1125.0f, 13.0f) },
            { "Chumash", new Vector3(-3192.6f, 1100.0f, 20.2f) },
            { "Windfarm", new Vector3(2354.0f, 1830.3f, 101.1f) },
            { "Military Base", new Vector3(-2047.4f, 3132.1f, 32.8f) },
            { "McKenzie Airfield", new Vector3(2121.7f, 4796.3f, 41.1f) },
            { "Desert Airfield", new Vector3(1747.0f, 3273.7f, 41.1f) },
            { "Chilliad", new Vector3(425.4f, 5614.3f, 766.5f) },
        };

        foreach (KeyValuePair <string, Vector3> location in teleportDict)
        {
            var buttonTeleportToLocation = new MenuButton(location.Key);
            buttonTeleportToLocation.Activated += (sender, args) => PlayerFunctions.TeleportToLocation(location);
            teleportMenuItems.Add(buttonTeleportToLocation);
        }

        TeleportMenu = new GTA.Menu("Teleport Options", teleportMenuItems.ToArray());
        DrawMenu(TeleportMenu);
    }
    private void Start()
    {
        if (GetComponent <ScriptManager>() && GetComponent <InteractManager>() && GetComponent <PlayerFunctions>())
        {
            inputManager = GetComponent <ScriptManager>().GetScript <InputController>();
            gameManager  = GetComponent <ScriptManager>().GetScript <HFPS_GameManager>();
            interact     = GetComponent <InteractManager>();
            pfunc        = GetComponent <PlayerFunctions>();
            paperUI      = gameManager.PaperTextUI;
            paperText    = gameManager.PaperReadText;
        }
        else
        {
            Debug.LogError("Missing one or more scripts in " + gameObject.name);
        }

        delay              = gameObject.transform.GetChild(0).GetChild(1).GetChild(0).GetChild(0).gameObject.GetComponent <DelayEffect>();
        playerCam          = Camera.main;
        ArmsCam            = GetComponent <ScriptManager>().ArmsCameraBlur.GetComponent <Camera>();
        DefaultMainCamMask = Camera.main.cullingMask;
        DefaultArmsCamMask = ArmsCam.cullingMask;
    }
Beispiel #25
0
 private void Awake()
 {
     instance = this;
 }
Beispiel #26
0
 public PlayerCards GetPlayerN(Player player)
 {
     return(PlayerFunctions.GetPlayer(player.NickName, dataManager.GetPlayerFromPlayerCards()));
 }
Beispiel #27
0
 public PlayerCards GetPlayerCardFromPlayerId(string playerId)
 {
     return(PlayerFunctions.GetPlayer(playerId, dataManager.GetPlayerFromPlayerCards()));
 }
Beispiel #28
0
    private void SublimePlayerMenu()
    {
        List <IMenuItem> playerMenuItems = new List <IMenuItem>();

        var buttonTeleport = new MenuButton("Teleport Menu");

        buttonTeleport.Activated += (sender, args) => SublimeTeleportMenu();
        playerMenuItems.Add(buttonTeleport);

        var buttonFixPlayer = new MenuButton("Fix Player");

        buttonFixPlayer.Activated += (sender, args) => PlayerFunctions.FixPlayer();
        playerMenuItems.Add(buttonFixPlayer);

        var buttonSetMoney = new MenuButton("Set Money");

        buttonSetMoney.Activated += (sender, args) => PlayerFunctions.SetMoney();
        playerMenuItems.Add(buttonSetMoney);

        var buttonAddMoney = new MenuButton("Add Money");

        buttonAddMoney.Activated += (sender, args) => PlayerFunctions.AddMoney();
        playerMenuItems.Add(buttonAddMoney);

        var numericWantedLevel = new MenuNumericScroller("Set Wanted Level", "", 0.0f, 5.0f, 1.0f, PlayerFunctions.WantedLevel);

        numericWantedLevel.Changed += (sender, args) => PlayerFunctions.SetWantedLevel(numericWantedLevel);
        playerMenuItems.Add(numericWantedLevel);

        var toggleNeverWanted = new MenuToggle("Never Wanted", "", PlayerFunctions.IsPlayerNeverWanted);

        toggleNeverWanted.Changed += (sender, args) => PlayerFunctions.ToggleNeverWanted();
        playerMenuItems.Add(toggleNeverWanted);

        var toggleInvincible = new MenuToggle("Invincible", "", PlayerFunctions.IsPlayerInvincible);

        toggleInvincible.Changed += (sender, args) => PlayerFunctions.ToggleInvincibility();
        playerMenuItems.Add(toggleInvincible);

        var toggleSuperJump = new MenuToggle("Super Jump", "", PlayerFunctions.CanPlayerSuperJump);

        toggleSuperJump.Changed += (sender, args) => PlayerFunctions.ToggleSuperJump();
        playerMenuItems.Add(toggleSuperJump);

        var toggleFastRun = new MenuToggle("Fast Run", "", PlayerFunctions.CanPlayerFastRun);

        toggleFastRun.Changed += (sender, args) => PlayerFunctions.ToggleFastRun();
        playerMenuItems.Add(toggleFastRun);

        var toggleFastSwim = new MenuToggle("Fast Swim", "", PlayerFunctions.CanPlayerFastSwim);

        toggleFastSwim.Changed += (sender, args) => PlayerFunctions.ToggleFastSwim();
        playerMenuItems.Add(toggleFastSwim);

        var toggleNoNoise = new MenuToggle("No Noise", "", PlayerFunctions.IsPlayerNoiseless);

        toggleNoNoise.Changed += (sender, args) => PlayerFunctions.ToggleNoNoise();
        playerMenuItems.Add(toggleNoNoise);

        var toggleUnlimitedStamina = new MenuToggle("Unlimited Stamina", "", PlayerFunctions.HasPlayerUnlimitedStamina);

        toggleUnlimitedStamina.Changed += (sender, args) => PlayerFunctions.ToggleUnlimitedStamina();
        playerMenuItems.Add(toggleUnlimitedStamina);

        var toggleUnlimitedBreath = new MenuToggle("Unlimited Breath", "", PlayerFunctions.HasPlayerUnlimitedBreath);

        toggleUnlimitedBreath.Changed += (sender, args) => PlayerFunctions.ToggleUnlimitedBreath();
        playerMenuItems.Add(toggleUnlimitedBreath);

        var toggleUnlimitedAbility = new MenuToggle("Unlimited Special Ability", "", PlayerFunctions.HasPlayerUnlimitedAbility);

        toggleUnlimitedAbility.Changed += (sender, args) => PlayerFunctions.ToggleUnlimitedAbility();
        playerMenuItems.Add(toggleUnlimitedAbility);

        PlayerMenu = new GTA.Menu("Player Options", playerMenuItems.ToArray());
        DrawMenu(PlayerMenu);
    }
Beispiel #29
0
            public static bool Prefix(PlayerFunctions __instance)
            {
                __instance.mastThresholdDepth   = __instance.playerVessel.databaseshipdata.periscopeDepthInFeet + 5;
                __instance.fullMessageLog       = new List <string>();
                __instance.fullMessageLogColors = new List <Color32>();
                __instance.numberOfLogEntries   = 0;
                if (__instance.currentFullLogParentObject != null)
                {
                    UnityEngine.Object.Destroy(__instance.currentFullLogParentObject);
                }
                __instance.currentFullLogParentObject = UnityEngine.Object.Instantiate(__instance.fullLogParentObject);
                __instance.currentFullLogParentObject.transform.SetParent(__instance.fullLogParentObject.transform, false);
                __instance.currentFullLogParentObject.GetComponent <UnityEngine.UI.Image>().enabled = true;
                __instance.fullLogScrollRect.content = __instance.currentFullLogParentObject.GetComponent <RectTransform>();
                __instance.fullLogObject.SetActive(false);
                __instance.fullLogToggleButton.SetActive(__instance.generateFullLog);
                __instance.playerSunkBy = string.Empty;
                __instance.hudHidden    = false;
                __instance.eventcamera.eventCameraOn = false;
                __instance.SetEventCameraMode();
                __instance.ballastRechargeTimer = 0f;
                __instance.ballastRechargeTime  = 120f;
                __instance.landAttackNumber     = 0;
                __instance.ClearStatusIcons();
                __instance.firstDepthCheckDone   = false;
                PlayerFunctions.draggingWaypoint = false;
                for (int i = 0; i < __instance.torpedoTubesGUIs.Length; i++)
                {
                    UnityEngine.Object.Destroy(__instance.torpedoTubesGUIs[i].gameObject);
                }
                __instance.weaponSprites = new Sprite[__instance.playerVessel.databaseshipdata.torpedoIDs.Length];
                for (int j = 0; j < __instance.playerVessel.databaseshipdata.torpedoIDs.Length; j++)
                {
                    __instance.weaponSprites[j] = UIFunctions.globaluifunctions.database.databaseweapondata[__instance.playerVessel.databaseshipdata.torpedoIDs[j]].weaponImage;
                }
                Vector2 vector = new Vector2(-260f, 36f);
                int     num    = Mathf.CeilToInt(__instance.playerVessel.databaseshipdata.torpedotubes / 2f);

                if (__instance.playerVessel.vesselmovement.weaponSource.hasVLS)
                {
                    num = Mathf.FloorToInt(__instance.playerVessel.databaseshipdata.torpedotubes / 2f);
                }
                //Debug.Log( "num=" + num );
                int   num2 = 1;
                float num3 = 0f;

                if (__instance.playerVessel.databaseshipdata.vlsTorpedoIDs != null)
                {
                    num2 = 0;
                    num3 = 36f;
                }
                float x    = vector.x;
                float num4 = vector.y * ((float)num - (float)num2);

                __instance.torpedoTubesGUIs  = new TorpedoTubeGUI[__instance.playerVessel.databaseshipdata.torpedotubes];
                __instance.torpedoTubeImages = new UnityEngine.UI.Image[__instance.playerVessel.databaseshipdata.torpedotubes];
                for (int k = 0; k < __instance.playerVessel.databaseshipdata.torpedotubes; k++)
                {
                    GameObject torpTube = UnityEngine.Object.Instantiate(__instance.torpedoTubeGUIObject, __instance.hudTransfrom.position, Quaternion.identity) as GameObject;
                    torpTube.SetActive(true);
                    torpTube.transform.SetParent(__instance.menuPanel.transform, true);
                    RectTransform component = torpTube.GetComponent <RectTransform>();
                    component.localScale             = Vector3.one;
                    torpTube.transform.localPosition = new Vector2(x, num4);
                    //Debug.Log( "Tube " + k + "pos=" + torpTube.transform.localPosition );
                    torpTube.name = k.ToString();
                    num4         -= vector.y;
                    if (k == num - 1)
                    {
                        x    = 0f;
                        num4 = vector.y * ((float)num - (float)num2);
                    }
                    torpTube.transform.SetParent(__instance.menuPanel.transform, true);
                    __instance.torpedoTubesGUIs[k]  = torpTube.GetComponent <TorpedoTubeGUI>();
                    __instance.torpedoTubeImages[k] = __instance.torpedoTubesGUIs[k].weaponInTube;
                    __instance.torpedoTubesGUIs[k].maskSprite.gameObject.GetComponent <UnityEngine.UI.Button>().onClick.AddListener(delegate {
                        __instance.ClickOnTube(int.Parse(torpTube.name));
                    });
                    UnityEngine.UI.ColorBlock colors = __instance.torpedoTubesGUIs[k].attackSettingButton.colors;
                    colors.normalColor      = __instance.helmmanager.buttonColors[1];
                    colors.highlightedColor = __instance.helmmanager.buttonColors[1];
                    colors.pressedColor     = __instance.helmmanager.buttonColors[1];
                    colors.disabledColor    = __instance.helmmanager.buttonColors[0];
                    __instance.torpedoTubesGUIs[k].attackSettingButton.colors = colors;
                    __instance.torpedoTubesGUIs[k].homeSettingButton.colors   = colors;
                    __instance.torpedoTubesGUIs[k].depthSettingButton.colors  = colors;
                }
                if (!GameDataManager.trainingMode && !GameDataManager.missionMode)
                {
                    UIFunctions.globaluifunctions.campaignmanager.GetPlayerCampaignData();
                }
                for (int l = 0; l < __instance.playerVessel.databaseshipdata.torpedotubes; l++)
                {
                    if (!GameDataManager.trainingMode && !GameDataManager.missionMode && UIFunctions.globaluifunctions.campaignmanager.playercampaigndata.playerTubeStatus[l] == -200)
                    {
                        __instance.torpedoTubeImages[l].sprite = UIFunctions.globaluifunctions.playerfunctions.tubeDestroyedSprite;
                        __instance.ClearTubeSettingButtons(l);
                        __instance.playerVessel.vesselmovement.weaponSource.tubeStatus[l]   = -200;
                        __instance.playerVessel.vesselmovement.weaponSource.weaponInTube[l] = -200;
                        continue;
                    }
                    int playerTorpedoIDInTubeOnInit = Traverse.Create(__instance).Method("GetPlayerTorpedoIDInTubeOnInit", new object[] { 1 }).GetValue <int>();
                    //int playerTorpedoIDInTubeOnInit = __instance.GetPlayerTorpedoIDInTubeOnInit( l );
                    bool  flag       = false;
                    int[] torpedoIDs = __instance.playerVessel.databaseshipdata.torpedoIDs;
                    foreach (int num5 in torpedoIDs)
                    {
                        if (playerTorpedoIDInTubeOnInit == num5)
                        {
                            flag = true;
                        }
                    }
                    if (!flag)
                    {
                        __instance.playerVessel.vesselmovement.weaponSource.tubeStatus[l]   = -10;
                        __instance.playerVessel.vesselmovement.weaponSource.weaponInTube[l] = -10;
                        __instance.torpedoTubeImages[l].gameObject.SetActive(false);
                        __instance.ClearTubeSettingButtons(l);
                    }
                    else
                    {
                        __instance.playerVessel.vesselmovement.weaponSource.torpedoSearchPattern[l] = __instance.GetSettingIndex(UIFunctions.globaluifunctions.database.databaseweapondata[playerTorpedoIDInTubeOnInit].searchSettings[0], __instance.attackSettingDefinitions);
                        __instance.playerVessel.vesselmovement.weaponSource.torpedoDepthPattern[l]  = __instance.GetSettingIndex(UIFunctions.globaluifunctions.database.databaseweapondata[playerTorpedoIDInTubeOnInit].heightSettings[0], __instance.depthSettingDefinitions);
                        __instance.playerVessel.vesselmovement.weaponSource.torpedoHomingPattern[l] = __instance.GetSettingIndex(UIFunctions.globaluifunctions.database.databaseweapondata[playerTorpedoIDInTubeOnInit].homeSettings[0], __instance.homeSettingDefinitions);
                        __instance.SetTubeSettingButtons(l);
                    }
                }
                Traverse.Create(__instance).Method("HighlightActiveTube").GetValue();
                //__instance.HighlightActiveTube();
                Vector2 v = new Vector2(0f, vector.y * (float)num + vector.y - 36f + num3);

                //Debug.Log( "v=" + v );
                __instance.signaturePanel.transform.localPosition  = v;
                __instance.conditionsPanel.transform.localPosition = v;
                __instance.damagePanel.transform.localPosition     = v;
                __instance.storesPanel.transform.localPosition     = v;
                __instance.messageLogPanel.transform.localPosition = new Vector2(0f, 36f * (float)num + 28f + num3);
                __instance.messageLogPositions = new Vector2(36f * (float)num + 28f + num3, 36f * (float)num + 275f + num3);
                if (__instance.currentOpenPanel != -1)
                {
                    __instance.OpenContextualPanel(__instance.currentOpenPanel);
                }
                __instance.currentSignatureIndex = 0;
                __instance.sensormanager.SetSonarSignatureLabelData(__instance.playerVessel.databaseshipdata.shipID, 2);
                __instance.DisableESMMeter();
                __instance.storesPanel.SetActive(false);
                __instance.wireData[0].text = string.Empty;
                __instance.wireData[1].text = string.Empty;
                return(false);
            }