Exemple #1
0
 /// <summary>
 /// subMethod to for fast access cached fields
 /// </summary>
 private void SubInitialiseFastAccess()
 {
     globalAuthority  = GameManager.i.globalScript.sideAuthority;
     globalResistance = GameManager.i.globalScript.sideResistance;
     Debug.Assert(globalAuthority != null, "Invalid GlobalAuthority (Null)");
     Debug.Assert(globalResistance != null, "Invalid GlobalResistance (Null)");
 }
    /// <summary>
    /// Actor tooltip
    /// </summary>
    /// <returns></returns>
    IEnumerator ShowActiveActorTooltip()
    {
        //delay before tooltip kicks in
        yield return(new WaitForSeconds(mouseOverDelay));

        //activate tool tip if mouse still over actor text
        if (onMouseFlag == true)
        {
            //do once
            while (GameManager.i.tooltipActorScript.CheckTooltipActive() == false)
            {
                GlobalSide side  = GameManager.i.sideScript.PlayerSide;
                Actor      actor = GameManager.i.dataScript.GetCurrentActor(actorSlotID, side);
                if (actor != null)
                {
                    ActorTooltipData data = actor.GetTooltipData(parent.transform.position);
                    GameManager.i.tooltipActorScript.SetTooltip(data, actorSlotID);
                }
                else
                {
                    Debug.LogWarningFormat("Invalid actor (Null) for actorSlotID {0}", actorSlotID);
                }
                yield return(null);
            }
            //fade in
            float alphaCurrent;
            while (GameManager.i.tooltipActorScript.GetOpacity() < 1.0)
            {
                alphaCurrent  = GameManager.i.tooltipActorScript.GetOpacity();
                alphaCurrent += Time.deltaTime / mouseOverFade;
                GameManager.i.tooltipActorScript.SetOpacity(alphaCurrent);
                yield return(null);
            }
        }
    }
    /// <summary>
    /// Set background image and cancel button for the appropriate side
    /// </summary>
    /// <param name="side"></param>
    private void ChangeSides(GlobalSide side)
    {
        Debug.Assert(side != null, "Invalid side (Null)");
        switch (side.level)
        {
        case 1:
            backgroundPanel.sprite = GameManager.i.sideScript.info_background_Authority;
            buttonClose.GetComponent <Image>().sprite = GameManager.i.sideScript.button_Authority;
            //set sprite transitions
            SpriteState spriteStateAuthority = new SpriteState();
            spriteStateAuthority.highlightedSprite = GameManager.i.sideScript.button_highlight_Authority;
            spriteStateAuthority.pressedSprite     = GameManager.i.sideScript.button_Click;
            buttonClose.spriteState = spriteStateAuthority;
            break;

        case 2:
            backgroundPanel.sprite = GameManager.i.sideScript.info_background_Resistance;
            buttonClose.GetComponent <Image>().sprite = GameManager.i.sideScript.button_Resistance;
            //set sprite transitions
            SpriteState spriteStateRebel = new SpriteState();
            spriteStateRebel.highlightedSprite = GameManager.i.sideScript.button_highlight_Resistance;
            spriteStateRebel.pressedSprite     = GameManager.i.sideScript.button_Click;
            buttonClose.spriteState            = spriteStateRebel;
            break;
        }
    }
    //
    // - - - Utilities
    //

    /// <summary>
    /// returns list of ActorArcs by side, null if a problem
    /// </summary>
    /// <param name="side"></param>
    /// <returns></returns>
    public List <ActorArc> GetActorArcs(GlobalSide side)
    {
        Debug.Assert(side != null, "Invalid side (Null)");
        List <ActorArc> listOfArcs = null;

        if (arrayOfActorArcs != null)
        {
            switch (side.name)
            {
            case "Authority":
                listOfArcs = arrayOfActorArcs.Where(x => string.Equals(x.side.name, "Authority", System.StringComparison.Ordinal) == true).ToList();
                break;

            case "Resistance":
                listOfArcs = arrayOfActorArcs.Where(x => string.Equals(x.side.name, "Resistance", System.StringComparison.Ordinal) == true).ToList();
                break;

            default: Debug.LogWarningFormat("Unrecognised globalSide.name \"{0}\"", side.name); break;
            }
        }
        else
        {
            Debug.LogError("Invalid arrayOfActorArcs (Null)");
        }
        return(listOfArcs);
    }
    /// <summary>
    /// set up sprites on actor tooltip for the appropriate side
    /// </summary>
    /// <param name="side"></param>
    public void InitialiseTooltip(GlobalSide side)
    {
        Debug.Assert(side != null, "Invalid side (Null)");
        //get component reference (done where because method called from GameManager which happens prior to this.Awake()
        background = tooltipPlayerObject.GetComponent <Image>();
        //assign side specific sprites
        switch (side.level)
        {
        case 1:
            //Authority
            background.sprite = GameManager.i.sideScript.toolTip_backgroundAuthority;
            divider_1.sprite  = GameManager.i.sideScript.toolTip_dividerAuthority;
            divider_2.sprite  = GameManager.i.sideScript.toolTip_dividerAuthority;
            divider_3.sprite  = GameManager.i.sideScript.toolTip_dividerAuthority;
            divider_4.sprite  = GameManager.i.sideScript.toolTip_dividerAuthority;
            divider_5.sprite  = GameManager.i.sideScript.toolTip_dividerAuthority;
            break;

        case 2:
            //Resistance
            background.sprite = GameManager.i.sideScript.toolTip_backgroundRebel;
            divider_1.sprite  = GameManager.i.sideScript.toolTip_dividerRebel;
            divider_2.sprite  = GameManager.i.sideScript.toolTip_dividerRebel;
            divider_3.sprite  = GameManager.i.sideScript.toolTip_dividerRebel;
            divider_4.sprite  = GameManager.i.sideScript.toolTip_dividerRebel;
            divider_5.sprite  = GameManager.i.sideScript.toolTip_dividerRebel;
            break;

        default:
            Debug.LogError(string.Format("Invalid side \"{0}\"", side.name));
            break;
        }
    }
    /// <summary>
    /// returns the next mission in the sequence for the specified side. Returns null if a problem
    /// </summary>
    /// <returns></returns>
    public Mission GetNextMission(GlobalSide side)
    {
        Mission mission       = null;
        int     scenarioIndex = GameManager.i.campaignScript.GetScenarioIndex();

        if (scenarioIndex < GameManager.i.campaignScript.GetMaxScenarioIndex())
        {
            scenarioIndex++;
            switch (side.level)
            {
            case 1:
                //Authority
                mission = GameManager.i.campaignScript.GetScenario(scenarioIndex).missionAuthority;
                break;

            case 2:
                //Resistance
                mission = GameManager.i.campaignScript.GetScenario(scenarioIndex).missionResistance;
                break;

            default: Debug.LogWarningFormat("Unrecognised side \"{0}\"", side.name); break;
            }
        }
        else
        {
            Debug.LogWarningFormat("Invalid scenarioIndex \"{0}\" (should be < Max Scenario Index {1})", scenarioIndex, GameManager.i.campaignScript.GetMaxScenarioIndex());
        }
        if (mission == null)
        {
            Debug.LogWarningFormat("Invalid mission (Null) for side \"{0}\"", side.name);
        }
        return(mission);
    }
Exemple #7
0
    /// <summary>
    /// returns side controlled by AI (opposite to that of the player). If both sides are AI then returns null. Returns null if a problem
    /// </summary>
    /// <returns></returns>
    public GlobalSide GetAISide()
    {
        GlobalSide aiSide = null;

        switch (_playerSide.level)
        {
        case 0:
            //AI
            break;

        case 1:
            //Authority
            aiSide = globalResistance;
            break;

        case 2:
            //Resistance
            aiSide = globalAuthority;
            break;

        default:
            Debug.LogError(string.Format("Invalid _playerSide.level \"{0}\"", _playerSide.level));
            break;
        }
        return(aiSide);
    }
 private void SubInitialiseFastAccess()
 {
     aiSide       = GameManager.i.sideScript.GetAISide();
     flashRedTime = GameManager.i.guiScript.flashRedTime;
     Debug.Assert(aiSide != null, "Invalid AI side (Null)");
     Debug.Assert(flashRedTime > 0, "Invalid flashRedTime ( <= 0 )");
 }
 /// <summary>
 /// Mouse Over event -> Shows actor tooltip if one present and a generic, info, tooltip, if not
 /// </summary>
 /// <param name="eventData"></param>
 public void OnPointerEnter(PointerEventData eventData)
 {
     side        = GameManager.i.sideScript.PlayerSide;
     onMouseFlag = true;
     if (GameManager.i.dataScript.CheckActorSlotStatus(actorSlotID, GameManager.i.sideScript.PlayerSide) == true)
     {
         actor = GameManager.i.dataScript.GetCurrentActor(actorSlotID, GameManager.i.sideScript.PlayerSide);
         if (actor != null)
         {
             //Don't want to clash with actor sprite tooltip
             if (actor.tooltipStatus == ActorTooltip.None)
             {
                 myCoroutine = StartCoroutine("ShowActiveActorTooltip");
             }
             else
             {
                 //InActive status, shows only if the text below sprite
                 if (isText == true)
                 {
                     myCoroutine = StartCoroutine("ShowActiveActorTooltip");
                 }
                 else
                 {
                     myCoroutine = StartCoroutine("ShowGenericTooltip");
                 }
             }
         }
     }
     else
     {
         myCoroutine = StartCoroutine("ShowVacantActorTooltip");
     }
 }
 private void SubInitialiseFastAccess()
 {
     //fast access fields
     globalAuthority = GameManager.i.globalScript.sideAuthority;
     globalBoth      = GameManager.i.globalScript.sideBoth;
     Debug.Assert(globalAuthority != null, "Invalid globalAuthority (Null)");
     Debug.Assert(globalBoth != null, "Invalid globalBoth (Null)");
     //decisions
     securityAPB       = "APB";
     securityAlert     = "SecAlert";
     securityCrackdown = "SurvCrackdwn";
 }
        public EventType triggerEvent;      //optional -> when Outcome closes will run this event



        public ModalOutcomeDetails()
        {
            modalLevel    = 1;
            modalState    = ModalSubState.None;
            isAction      = false;
            isSpecial     = false;
            isSpecialGood = true;
            reason        = "Unknown";
            side          = GameManager.i.sideScript.PlayerSide;
            sprite        = GameManager.i.spriteScript.infoSprite;
            type          = MsgPipelineType.None;
            listOfNodes   = new List <Node>();
            triggerEvent  = EventType.None;
        }
    /// <summary>
    /// Set city loyalty to a new value (Debug Action Menu). Auto clamps value to allowable limits
    /// </summary>
    /// <param name="input_0"></param>
    /// <returns></returns>
    public string DebugSetLoyalty(string input_0)
    {
        GlobalSide playerSide = GameManager.i.sideScript.PlayerSide;
        string     reply      = "";
        int        newLoyalty = -1;

        try
        { newLoyalty = Convert.ToInt32(input_0); }
        catch (OverflowException)
        { reply = $"Invalid City Loyalty input {input_0}"; }
        newLoyalty  = Mathf.Clamp(newLoyalty, 0, 10);
        CityLoyalty = newLoyalty;
        reply       = $"City Loyalty is now {_cityLoyalty} (DEBUG)";
        return(reply);
    }
    /// <summary>
    /// toggles actor Power/compatibility display. If 'showPower' true POWER, false COMPATIBILITY and no actor present in slot (Vacant) will auto switch off
    /// </summary>
    /// <param name="showPower"></param>
    public void SetActorInfoUI(bool showPower)
    {
        //switch off any relevant tooltip (Power/compatibility)
        GameManager.i.tooltipGenericScript.CloseTooltip("ActorPanelUI", GenericTooltipType.ActorInfo);
        //toggle
        GameManager.i.optionScript.showPower = showPower;
        GlobalSide side = GameManager.i.sideScript.PlayerSide;

        for (int index = 0; index < arrayOfPowerCircles.Length; index++)
        {
            if (showPower == true)
            {
                //display POWER
                arrayOfCompatibility[index].gameObject.SetActive(false);
                if (GameManager.i.dataScript.CheckActorSlotStatus(index, side) == true)
                {
                    arrayOfPowerCircles[index].gameObject.SetActive(showPower);
                }
                else
                {
                    arrayOfPowerCircles[index].gameObject.SetActive(false);
                    UpdateActorPowerUI(index, 0);
                }
            }
            else
            {
                //display COMPATIBILITY
                arrayOfPowerCircles[index].gameObject.SetActive(false);
                if (GameManager.i.dataScript.CheckActorSlotStatus(index, side) == true)
                {
                    arrayOfCompatibility[index].gameObject.SetActive(true);
                }
                else
                {
                    arrayOfCompatibility[index].gameObject.SetActive(false);
                    UpdateActorCompatibilityUI(index, 0);
                }
            }
        }

        /*//player is never vacant -> EDIT player Power shown regardless
         * powerCirclePlayer.gameObject.SetActive(showPower);*/

        //update flag
        isPowerUI = showPower;
        //logging
        Debug.LogFormat("[UI] ActorPanelUI.cs -> ToggleActorInfoUI: {0}{1}", showPower == true ? "POWER" : "COMPATIBILITY", "\n");
    }
Exemple #14
0
    /// <summary>
    /// Tutorial
    /// </summary>
    private void SubInitialiseTutorial()
    {
        Tutorial tutorial = GameManager.i.tutorialScript.tutorial;

        if (tutorial != null)
        {
            //HUMAN Player
            switch (tutorial.side.level)
            {
            case 1:
                //Authority player
                PlayerSide = globalAuthority;
                Debug.Log("[Start] Player set to AUTHORITY side");
                resistanceOverall = SideState.AI;
                authorityOverall  = SideState.Human;
                resistanceCurrent = SideState.AI;
                authorityCurrent  = SideState.Human;
                //names
                GameManager.i.playerScript.SetPlayerNameResistance(GameManager.i.scenarioScript.scenario.leaderResistance.leaderName);
                GameManager.i.playerScript.SetPlayerNameAuthority(GameManager.i.preloadScript.nameAuthority);
                break;

            case 2:
                //Resistance player
                PlayerSide = GameManager.i.globalScript.sideResistance;
                Debug.Log("[Start] Player set to RESISTANCE side");
                resistanceOverall = SideState.Human;
                authorityOverall  = SideState.AI;
                resistanceCurrent = SideState.Human;
                authorityCurrent  = SideState.AI;
                //names
                GameManager.i.playerScript.SetPlayerNameResistance(GameManager.i.preloadScript.nameResistance);
                GameManager.i.playerScript.SetPlayerNameAuthority(GameManager.i.scenarioScript.scenario.leaderAuthority.mayorName);
                break;

            default:
                Debug.LogWarningFormat("Unrecognised tutorial side \"{0}\"", tutorial.side.name);
                break;
            }
            //set first name
            GameManager.i.playerScript.SetPlayerFirstName(GameManager.i.preloadScript.nameFirst);
        }
        else
        {
            Debug.LogError("Invalid tutorial (Null)");
        }
    }
Exemple #15
0
 /// <summary>
 /// Mouse Over event -> show tooltip if Player tooltipStatus > ActorTooltip.None
 /// </summary>
 /// <param name="eventData"></param>
 public void OnPointerEnter(PointerEventData eventData)
 {
     onMouseFlag = true;
     //
     // - - - Tooltip - - -
     //
     side = GameManager.i.sideScript.PlayerSide;
     //activate tooltip if there is a valid reason
     if (GameManager.i.playerScript.tooltipStatus > ActorTooltip.None)
     {
         myTooltipCoroutine = StartCoroutine("ShowSpecialTooltip");
     }
     else
     {
         //normal status -> show standard player tooltip
         myTooltipCoroutine = StartCoroutine("ShowPlayerTooltip");
     }
 }
    /// <summary>
    /// Set city loyalty, faction bar colour & action points for the appropriate side
    /// </summary>
    /// <param name="side"></param>
    private void SetSides(GlobalSide side)
    {
        Debug.Assert(side != null, "Invalid side (Null)");
        SetCityBar(GameManager.i.cityScript.CityLoyalty);
        SetActionPoints(GameManager.i.turnScript.GetActionsTotal());
        switch (side.level)
        {
        case 1:
            //authority
            SetFactionBar(GameManager.i.hqScript.ApprovalAuthority);
            break;

        case 2:
            //resistance
            SetFactionBar(GameManager.i.hqScript.ApprovalResistance);
            break;
        }
    }
    /// <summary>
    /// Mouse click -> Right: Actor Action Menu
    /// </summary>
    public void OnPointerClick(PointerEventData eventData)
    {
        GlobalSide side = GameManager.i.sideScript.PlayerSide;

        switch (eventData.button)
        {
        case PointerEventData.InputButton.Left:
            Debug.LogFormat("[Tst] InventoryInteraction.cs -> OnPointerClick: LEFT BUTTON CLICKED{0}", "\n");
            break;

        case PointerEventData.InputButton.Right:
            Debug.LogFormat("[Tst] InventoryInteraction.cs -> OnPointerClick: RIGHT BUTTON CLICKED{0}", "\n");
            break;

        default:
            Debug.LogError("Unknown InputButton");
            break;
        }
    }
Exemple #18
0
 /// <summary>
 /// Fast access submethod
 /// </summary>
 private void SubInitialiseFastAccess()
 {
     //fast access fields
     globalResistance = GameManager.i.globalScript.sideResistance;
     globalAuthority  = GameManager.i.globalScript.sideAuthority;
     maxStatValue     = GameManager.i.nodeScript.maxNodeValue;
     minStatValue     = GameManager.i.nodeScript.minNodeValue;
     Debug.Assert(globalResistance != null, "Invalid globalResistance (Null)");
     Debug.Assert(globalAuthority != null, "Invalid globalAuthority (Null)");
     Debug.Assert(maxStatValue > -1, "Invalid maxStatValue (-1)");
     Debug.Assert(minStatValue > -1, "Invalid minStatValue (-1)");
     //Node datapoint Icons
     arrayOfIcons[0] = GameManager.i.guiScript.stabilityIcon;
     arrayOfIcons[1] = GameManager.i.guiScript.supportIcon;
     arrayOfIcons[2] = GameManager.i.guiScript.securityIcon;
     Debug.Assert(arrayOfIcons[0] != null, "Invalid arrayOfIcons[0], Stability (Null)");
     Debug.Assert(arrayOfIcons[1] != null, "Invalid arrayOfIcons[1], Support (Null)");
     Debug.Assert(arrayOfIcons[2] != null, "Invalid arrayOfIcons[2], Security (Null)");
 }
Exemple #19
0
    /// <summary>
    /// Show generic tooltip
    /// </summary>
    /// <returns></returns>
    IEnumerator ShowTooltip()
    {
        //delay before tooltip kicks in
        yield return(new WaitForSeconds(mouseOverDelay));

        playerSide = GameManager.i.sideScript.PlayerSide;
        //activate tool tip if mouse still over button
        if (onMouseFlag == true && GameManager.i.inputScript.ModalState == ModalState.Normal)
        {
            //do once
            Vector3 screenPos = transform.position;
            screenPos.x -= 20;
            screenPos.y -= 90;
            while (GameManager.i.tooltipGenericScript.CheckTooltipActive() == false)
            {
                tooltipHeader  = GameManager.i.hqScript.GetHqName(playerSide);
                tooltipMain    = GameManager.i.hqScript.GetHqDescription(playerSide);
                tooltipDetails = GameManager.i.hqScript.GetHqDetails(playerSide);
                GenericTooltipData data = new GenericTooltipData()
                {
                    screenPos = screenPos, main = tooltipMain, header = tooltipHeader, details = tooltipDetails
                };
                GameManager.i.tooltipGenericScript.SetTooltip(data);
                yield return(null);
            }

            /*//fade in
             * float alphaCurrent;
             * while (GameManager.instance.tooltipGenericScript.GetOpacity() < 1.0)
             * {
             *  alphaCurrent = GameManager.instance.tooltipGenericScript.GetOpacity();
             *  alphaCurrent += Time.deltaTime / mouseOverFade;
             *  GameManager.instance.tooltipGenericScript.SetOpacity(alphaCurrent);
             *  yield return null;
             * }*/
        }
    }
    /* /// <summary>
     * /// returns a colour formatted string of the Faction's trait. Used by cityInfoUI faction tooltip
     * /// </summary>
     * /// <returns></returns>
     * public string GetFactionTraitFormatted()
     * {
     *   StringBuilder builder = new StringBuilder();
     *   builder.AppendFormat("<font=\"Bangers SDF\"><cspace=1em>{0}</cspace></font>", city.faction.GetTrait().tagFormatted);
     *   builder.AppendFormat("{0}{1}{2}{3}", "\n", colourAlert, city.faction.GetTrait().description, colourEnd);
     *   return builder.ToString();
     * }*/

    /// <summary>
    /// checks city loyalty once per turn for min and max conditions, sets timers, gives outcomes. Checks for both sides, depending on who is player
    /// </summary>
    public void CheckCityLoyaltyAtLimit()
    {
        bool       isAtLimit = false;
        bool       isMaxLoyalty = false;
        bool       isMinLoyalty = false;
        string     msgText, itemText, reason, warning;
        bool       isBad;
        GlobalSide side = GameManager.i.sideScript.PlayerSide;

        //check if loyalty at limit
        if (_cityLoyalty == 0)
        {
            isAtLimit = true; isMinLoyalty = true;
        }
        else if (_cityLoyalty >= maxCityLoyalty)
        {
            isAtLimit = true; isMaxLoyalty = true;
        }
        //only check once per turn
        if (isAtLimit == true && isLoyaltyCheckedThisTurn == false)
        {
            isLoyaltyCheckedThisTurn = true;
            //
            // - - - Min Loyalty - - -
            //
            if (isMinLoyalty == true)
            {
                if (loyaltyMinTimer == 0)
                {
                    //set timer
                    loyaltyMinTimer = loyaltyCountdownTimer;
                    //message
                    msgText  = string.Format("{0} Loyalty at zero. Resistance wins in {1} turn{2}", city.tag, loyaltyMinTimer, loyaltyMinTimer != 1 ? "s" : "");
                    itemText = string.Format("{0} Loyalty at ZERO", city.tag);
                    reason   = string.Format("{0} Loyalty has Flat Lined", city.tag);
                    warning  = string.Format("Resistance wins in {0} turn{1}", loyaltyMinTimer, loyaltyMinTimer != 1 ? "s" : "");
                    //good for Resistance, bad for Authority player
                    isBad = false;
                    if (GameManager.i.sideScript.PlayerSide.level == GameManager.i.globalScript.sideAuthority.level)
                    {
                        isBad = true;
                    }
                    GameManager.i.messageScript.GeneralWarning(msgText, itemText, "City Loyalty Crisis", reason, warning, true, isBad);
                }
                else
                {
                    //decrement timer
                    loyaltyMinTimer--;
                    //game over at zero
                    if (loyaltyMinTimer == 0)
                    {
                        //message
                        msgText  = string.Format("{0} Loyalty at zero. Resistance wins", city.tag);
                        itemText = string.Format("{0} has aligned with Resistance", city.tag);
                        reason   = string.Format("{0} Loyalty has been at ZERO for an extended period", city.tag);
                        warning  = "Resistance has Won";
                        //good for Resistance, bad for Authority player
                        isBad = false;
                        if (GameManager.i.sideScript.PlayerSide.level == GameManager.i.globalScript.sideAuthority.level)
                        {
                            isBad = true;
                        }
                        GameManager.i.messageScript.GeneralWarning(msgText, itemText, "Resistance Wins", reason, warning, true, isBad);
                        //Loyalty at Min -> Resistance wins
                        string textTop    = string.Format("{0}{1} has lost faith in the Authorities and joined the Resistance{2}", colourNormal, city.tag, colourEnd);
                        string textBottom = string.Format("{0}Resistance WINS{1}{2}{3}{4}Authority LOSES{5}", colourGood, colourEnd, "\n", "\n", colourBad, colourEnd);
                        GameManager.i.turnScript.SetWinStateLevel(WinStateLevel.Resistance, WinReasonLevel.CityLoyaltyMin, textTop, textBottom);
                    }
                    else
                    {
                        //message
                        msgText  = string.Format("{0} Loyalty at zero. Resistance wins in {1} turn{2}", city.tag, loyaltyMinTimer, loyaltyMinTimer != 1 ? "s" : "");
                        itemText = string.Format("{0} Loyalty is wavering", city.tag);
                        reason   = string.Format("{0} is considering aligning itself with the Resistance", city.tag);
                        warning  = string.Format("Resistance wins in {0} turn{1}", loyaltyMinTimer, loyaltyMinTimer != 1 ? "s" : "");
                        //good for Resistance, bad for Authority player
                        isBad = false;
                        if (GameManager.i.sideScript.PlayerSide.level == GameManager.i.globalScript.sideAuthority.level)
                        {
                            isBad = true;
                        }
                        GameManager.i.messageScript.GeneralWarning(msgText, itemText, "Loyalty at Zero", reason, warning, true, isBad);
                    }
                }
            }
            //
            // - - - Max Loyalty - - -
            //
            else if (isMaxLoyalty == true)
            {
                if (loyaltyMaxTimer == 0)
                {
                    //set timer
                    loyaltyMaxTimer = loyaltyCountdownTimer;
                    //message
                    msgText  = string.Format("{0} Loyalty at MAX. Authority wins in {1} turn{2}", city.tag, loyaltyMaxTimer, loyaltyMaxTimer != 1 ? "s" : "");
                    itemText = string.Format("{0} Loyalty is at MAXIMUM", city.tag);
                    reason   = string.Format("{0} Loyalty to the Authority is overwhelming", city.tag);
                    warning  = string.Format("Authority wins in {0} turn{1}", loyaltyMaxTimer, loyaltyMaxTimer != 1 ? "s" : "");
                    //good for Authority, bad for Resistance player
                    isBad = true;
                    if (GameManager.i.sideScript.PlayerSide.level == GameManager.i.globalScript.sideAuthority.level)
                    {
                        isBad = false;
                    }
                    GameManager.i.messageScript.GeneralWarning(msgText, itemText, "Maximum Loyalty", reason, warning, true, isBad);
                }
                else
                {
                    //decrement timer
                    loyaltyMaxTimer--;
                    //game over at zero
                    if (loyaltyMaxTimer == 0)
                    {
                        //message
                        msgText  = string.Format("{0} Loyalty at MAX. Authority wins", city.tag);
                        itemText = string.Format("{0} has aligned fully with Authority", city.tag);
                        reason   = string.Format("{0} Loyalty has been MAX for an extended period", city.tag);
                        warning  = "Authority has Won";
                        //good for Authority, bad for Resistance player
                        isBad = true;
                        if (GameManager.i.sideScript.PlayerSide.level == GameManager.i.globalScript.sideAuthority.level)
                        {
                            isBad = false;
                        }
                        GameManager.i.messageScript.GeneralWarning(msgText, itemText, "Authority Wins", reason, warning, true, isBad);
                        //Loyalty at Max -> Authority wins
                        string textTop    = string.Format("{0}{1} has lost all interest in joining the Resistance{2}", colourNormal, city.tag, colourEnd);
                        string textBottom = string.Format("{0}Authority WINS{1}{2}{3}{4}Resistance LOSES{5}", colourGood, colourEnd, "\n", "\n", colourBad, colourEnd);
                        GameManager.i.turnScript.SetWinStateLevel(WinStateLevel.Authority, WinReasonLevel.CityLoyaltyMax, textTop, textBottom);
                    }
                    else
                    {
                        //message
                        msgText  = string.Format("{0} Loyalty at MAX. Authority wins in {1} turn{2}", city.tag, loyaltyMaxTimer, loyaltyMaxTimer != 1 ? "s" : "");
                        itemText = string.Format("{0} Loyalty is overwhelming", city.tag);
                        reason   = string.Format("{0} is considering aligning itself fully with the Authority", city.tag);
                        warning  = string.Format("Authority wins in {0} turn{1}", loyaltyMaxTimer, loyaltyMaxTimer != 1 ? "s" : "");
                        //good for Authority, bad for Resistance player
                        isBad = true;
                        if (GameManager.i.sideScript.PlayerSide.level == GameManager.i.globalScript.sideAuthority.level)
                        {
                            isBad = false;
                        }
                        GameManager.i.messageScript.GeneralWarning(msgText, itemText, "Loyalty MAXXED", reason, warning, true, isBad);
                    }
                }
            }
        }
        else
        {
            //set both timers to zero (loyalty neither min nor max)
            loyaltyMinTimer = 0;
            loyaltyMaxTimer = 0;
        }
    }
Exemple #21
0
    /// <summary>
    /// Mouse click -> Right: Actor Action Menu
    /// </summary>
    public void OnPointerClick(PointerEventData eventData)
    {
        GlobalSide playerSide  = GameManager.i.sideScript.PlayerSide;
        bool       proceedFlag = true;

        switch (eventData.button)
        {
        case PointerEventData.InputButton.Left:
            if (GameManager.i.guiScript.CheckIsBlocked(2) == false)
            {
                switch (type)
                {
                case ModalInventorySubState.HQ:
                    if (GameManager.i.optionScript.isActorLeftMenu == true)
                    {
                        //HQ actor review
                        TabbedUIData tabbedDetailsHq = new TabbedUIData()
                        {
                            side       = playerSide,
                            who        = TabbedUIWho.HQ,
                            slotID     = actorSlotID,
                            modalLevel = 2,
                            modalState = ModalSubState.Inventory
                        };
                        EventManager.i.PostNotification(EventType.TabbedOpen, this, tabbedDetailsHq, "InventoryInteraction.cs -> OnPointerClick");
                    }
                    break;

                case ModalInventorySubState.ReservePool:
                    if (GameManager.i.optionScript.isActorLeftMenu == true)
                    {
                        //Reserves actor review
                        TabbedUIData tabbedDetailsReserves = new TabbedUIData()
                        {
                            side       = playerSide,
                            who        = TabbedUIWho.Reserves,
                            slotID     = actorSlotID,
                            modalLevel = 2,
                            modalState = ModalSubState.Inventory
                        };
                        EventManager.i.PostNotification(EventType.TabbedOpen, this, tabbedDetailsReserves, "InventoryInteraction.cs -> OnPointerClick");
                    }
                    break;
                }
            }
            break;

        case PointerEventData.InputButton.Right:
            if (GameManager.i.guiScript.CheckIsBlocked(2) == false)
            {
                //Action Menu -> not valid if Resistance Plyr and player captured, etc.
                if (GameManager.i.playerScript.status != ActorStatus.Active)
                {
                    proceedFlag = false;
                }
                if (proceedFlag == true)
                {
                    switch (type)
                    {
                    case ModalInventorySubState.Gear:
                        Gear gear = GameManager.i.dataScript.GetGear(optionName);
                        if (gear != null)
                        {
                            //adjust position prior to sending
                            Vector3 position = transform.position;
                            position.x += 25;
                            position.y -= 50;
                            position    = Camera.main.ScreenToWorldPoint(position);
                            //gear
                            ModalGenericMenuDetails details = new ModalGenericMenuDetails()
                            {
                                /*itemID = gear.gearID,*/
                                itemName            = gear.tag,
                                modalLevel          = 2,
                                modalState          = ModalSubState.Inventory,
                                itemDetails         = string.Format("{0}", gear.type.name),
                                menuPos             = position,
                                listOfButtonDetails = GameManager.i.actorScript.GetGearInventoryActions(gear.name),
                                menuType            = ActionMenuType.Gear
                            };
                            //activate menu
                            GameManager.i.actionMenuScript.SetActionMenu(details);
                        }
                        else
                        {
                            Debug.LogError(string.Format("Invalid Gear (Null) for gearID / optionData {0}", optionData));
                        }
                        break;

                    case ModalInventorySubState.ReservePool:
                        if (GameManager.i.optionScript.isActorRightMenu == true)
                        {
                            Actor actor = GameManager.i.dataScript.GetActor(optionData);
                            if (actor != null)
                            {
                                //adjust position prior to sending
                                Vector3 position = transform.position;
                                position.x += 25;
                                position.y -= 50;
                                position    = Camera.main.ScreenToWorldPoint(position);
                                //reserve actions menu
                                ModalGenericMenuDetails details = new ModalGenericMenuDetails()
                                {
                                    itemID              = actor.actorID,
                                    itemName            = actor.actorName,
                                    modalLevel          = 2,
                                    modalState          = ModalSubState.Inventory,
                                    itemDetails         = string.Format("{0} ID {1}", actor.arc.name, actor.actorID),
                                    menuPos             = position,
                                    listOfButtonDetails = GameManager.i.actorScript.GetReservePoolActions(actor.actorID),
                                    menuType            = ActionMenuType.Reserve
                                };
                                //activate menu
                                GameManager.i.actionMenuScript.SetActionMenu(details);
                            }
                            else
                            {
                                Debug.LogError(string.Format("Invalid Actor (Null) for actorID / optionData {0}", optionData));
                            }
                        }
                        break;
                        //NOTE: no default option as some SubStates, eg. HQ don't have a Right click option
                    }
                }
                else
                {
                    //player not active
                    GameManager.i.guiScript.SetAlertMessageModalTwo(AlertType.PlayerStatus, ModalSubState.Inventory);
                }
            }
            break;

        default:
            Debug.LogError("Unknown InputButton");
            break;
        }
    }
Exemple #22
0
    public void Initialise(GameState state)
    {
        //field checks
        Debug.Assert(string.IsNullOrEmpty(tagGlobalAIName) == false, "Invalid tagGlobalAIName (Null or Empty)");
        Debug.Assert(string.IsNullOrEmpty(tagGlobalDrug) == false, "Invalid tagGlobalDrug (Null or Empty)");
        //main
        int num;

        GlobalMeta[] arrayOfGlobalMeta = GameManager.i.loadScript.arrayOfGlobalMeta;
        num = arrayOfGlobalMeta.Length;
        if (num > 0)
        {
            for (int i = 0; i < num; i++)
            {
                GlobalMeta assetSO = arrayOfGlobalMeta[i];
                //pick out and assign the ones required for fast acess, ignore the rest.
                //Also dynamically assign GlobalMeta.level values (0/1/2).
                switch (assetSO.name)
                {
                case "Local":
                    metaBottom    = assetSO;
                    assetSO.level = 0;
                    break;

                case "State":
                    metaMiddle    = assetSO;
                    assetSO.level = 1;
                    break;

                case "National":
                    metaTop       = assetSO;
                    assetSO.level = 2;
                    break;

                default:
                    Debug.LogWarningFormat("Invalid meta \"{0}\"", assetSO.name);
                    break;
                }
            }
            //error check
            if (metaBottom == null)
            {
                Debug.LogError("Invalid metaBottom (Null)");
            }
            if (metaMiddle == null)
            {
                Debug.LogError("Invalid metaMiddle (Null)");
            }
            if (metaTop == null)
            {
                Debug.LogError("Invalid metaTop (Null)");
            }
        }
        //
        // - - - GlobalChance - - -
        //
        GlobalChance[] arrayOfGlobalChance = GameManager.i.loadScript.arrayOfGlobalChance;
        num = arrayOfGlobalChance.Length;
        if (num > 0)
        {
            for (int i = 0; i < num; i++)
            {
                GlobalChance assetSO = arrayOfGlobalChance[i];
                //pick out and assign the ones required for fast acess, ignore the rest.
                //Also dynamically assign GlobalChance.level values (0/1/2).
                switch (assetSO.name)
                {
                case "Low":
                    chanceLow     = assetSO;
                    assetSO.level = 0;
                    break;

                case "Medium":
                    chanceMedium  = assetSO;
                    assetSO.level = 1;
                    break;

                case "High":
                    chanceHigh    = assetSO;
                    assetSO.level = 2;
                    break;

                case "Extreme":
                    chanceExtreme = assetSO;
                    assetSO.level = 3;
                    break;

                default:
                    Debug.LogWarningFormat("Invalid chance \"{0}\"", assetSO.name);
                    break;
                }
            }
            //error check
            if (chanceLow == null)
            {
                Debug.LogError("Invalid chanceLow (Null)");
            }
            if (chanceMedium == null)
            {
                Debug.LogError("Invalid chanceMedium (Null)");
            }
            if (chanceHigh == null)
            {
                Debug.LogError("Invalid chanceHigh (Null)");
            }
            if (chanceExtreme == null)
            {
                Debug.LogError("Invalid chanceCritical (Null)");
            }
        }
        //
        // - - - GlobalWho - - -
        //
        GlobalWho[] arrayOfGlobalWho = GameManager.i.loadScript.arrayOfGlobalWho;
        num = arrayOfGlobalWho.Length;
        if (num > 0)
        {
            for (int i = 0; i < num; i++)
            {
                GlobalWho assetSO = arrayOfGlobalWho[i];
                //pick out and assign the ones required for fast acess, ignore the rest.
                //Also dynamically assign GlobalWho.level values (0/1/2).
                switch (assetSO.name)
                {
                case "Player":
                    whoPlayer     = assetSO;
                    assetSO.level = 0;
                    break;

                case "Actor":
                    whoActor      = assetSO;
                    assetSO.level = 1;
                    break;

                default:
                    Debug.LogWarningFormat("Invalid GlobalWho \"{0}\"", assetSO.name);
                    break;
                }
            }
            //error check
            if (whoPlayer == null)
            {
                Debug.LogError("Invalid whoPlayer (Null)");
            }
            if (whoActor == null)
            {
                Debug.LogError("Invalid whoActor (Null)");
            }
        }
        //
        // - - - GlobalType - - -
        //
        GlobalType[] arrayOfGlobalType = GameManager.i.loadScript.arrayOfGlobalType;
        num = arrayOfGlobalType.Length;
        if (num > 0)
        {
            for (int i = 0; i < num; i++)
            {
                GlobalType assetSO = arrayOfGlobalType[i];
                //pick out and assign the ones required for fast acess, ignore the rest.
                //Also dynamically assign GlobalType.level values (0/1/2).
                switch (assetSO.name)
                {
                case "Bad":
                    typeBad       = assetSO;
                    assetSO.level = 0;
                    break;

                case "Neutral":
                    typeNeutral   = assetSO;
                    assetSO.level = 1;
                    break;

                case "Good":
                    typeGood      = assetSO;
                    assetSO.level = 2;
                    break;

                default:
                    Debug.LogWarningFormat("Invalid type \"{0}\"", assetSO.name);
                    break;
                }
            }
            //error check
            if (typeBad == null)
            {
                Debug.LogError("Invalid typeBad (Null)");
            }
            if (typeNeutral == null)
            {
                Debug.LogError("Invalid typeNeutral (Null)");
            }
            if (typeGood == null)
            {
                Debug.LogError("Invalid typeGood (Null)");
            }
        }
        //
        // - - - GlobalSide - - -
        //
        GlobalSide[] arrayOfGlobalSide = GameManager.i.loadScript.arrayOfGlobalSide;
        num = arrayOfGlobalSide.Length;
        if (num > 0)
        {
            for (int i = 0; i < num; i++)
            {
                GlobalSide assetSO = arrayOfGlobalSide[i];
                //pick out and assign the ones required for fast acess, ignore the rest.
                //Also dynamically assign GlobalSide.level values (0/1/2).
                switch (assetSO.name)
                {
                case "AI":
                    sideAI        = assetSO;
                    assetSO.level = 0;
                    break;

                case "Authority":
                    sideAuthority = assetSO;
                    assetSO.level = 1;
                    break;

                case "Resistance":
                    sideResistance = assetSO;
                    assetSO.level  = 2;
                    break;

                case "Both":
                    sideBoth      = assetSO;
                    assetSO.level = 3;
                    break;

                default:
                    Debug.LogWarningFormat("Invalid side \"{0}\"", assetSO.name);
                    break;
                }
            }
            //error check
            Debug.Assert(sideAI != null, "Invalid sideAI (Null)");
            Debug.Assert(sideAuthority != null, "Invalid sideAuthority (Null)");
            Debug.Assert(sideResistance != null, "Invalid sideResistance (Null)");
            Debug.Assert(sideBoth != null, "Invalid sideBoth (Null)");
        }
        NodeDatapoint[] arrayOfNodeDatapoints = GameManager.i.loadScript.arrayOfNodeDatapoints;
        num = arrayOfNodeDatapoints.Length;
        if (num > 0)
        {
            for (int i = 0; i < num; i++)
            {
                NodeDatapoint assetSO = arrayOfNodeDatapoints[i];
                //pick out and assign the ones required for fast acess, ignore the rest.
                //Also dynamically assign NodeDatapoint.level values (0/1/2).
                switch (assetSO.name)
                {
                case "Stability":
                    nodeStability = assetSO;
                    assetSO.level = 0;
                    break;

                case "Support":
                    nodeSupport   = assetSO;
                    assetSO.level = 1;
                    break;

                case "Security":
                    nodeSecurity  = assetSO;
                    assetSO.level = 2;
                    break;

                default:
                    Debug.LogWarningFormat("Invalid NodeDatapoint \"{0}\"", assetSO.name);
                    break;
                }
            }
            //error check
            Debug.Assert(nodeStability != null, "Invalid nodeStability (Null)");
            Debug.Assert(nodeSupport != null, "Invalid nodeSupport (Null)");
            Debug.Assert(nodeSecurity != null, "Invalid nodeSecurity (Null)");
        }
        //
        // - - - Trait Categories - - -
        //
        categoryActor = GameManager.i.dataScript.GetTraitCategory("Actor");
        categoryMayor = GameManager.i.dataScript.GetTraitCategory("Mayor");
        Debug.Assert(categoryActor != null, "Invalid categoryActor");
        Debug.Assert(categoryMayor != null, "Invalid categoryMayor");
    }
Exemple #23
0
    /// <summary>
    /// Mouse click -> Left: Dossier, Right: Actor Action Menu
    /// </summary>
    public void OnPointerClick(PointerEventData eventData)
    {
        if (GameManager.i.optionScript.isSubordinates == true)
        {
            GlobalSide playerSide  = GameManager.i.sideScript.PlayerSide;
            bool       proceedFlag = true;
            int        data        = -1;
            AlertType  alertType   = AlertType.None;
            //is there an actor in this slot?
            if (GameManager.i.dataScript.CheckActorSlotStatus(actorSlotID, playerSide) == true)
            {
                //close actor tooltip
                GameManager.i.tooltipActorScript.CloseTooltip("ActorClickUI.cs -> OnPointerClick");
                //which button
                switch (eventData.button)
                {
                case PointerEventData.InputButton.Left:
                    if (GameManager.i.optionScript.isActorLeftMenu == true)
                    {
                        //actor review
                        TabbedUIData tabbedDetails = new TabbedUIData()
                        {
                            side   = playerSide,
                            who    = TabbedUIWho.Subordinates,
                            slotID = GameManager.i.dataScript.GetActorPosition(actorSlotID, playerSide),
                        };
                        EventManager.i.PostNotification(EventType.TabbedOpen, this, tabbedDetails, "ActorClickUI.cs -> OnPointerClick");
                    }
                    else
                    {
                        GameManager.i.guiScript.SetAlertMessageModalOne(AlertType.TutorialDossierUnavailable);
                    }
                    break;

                case PointerEventData.InputButton.Right:
                    if (GameManager.i.guiScript.CheckIsBlocked() == false)
                    {
                        //Action Menu -> not valid if AI is active for side
                        if (GameManager.i.sideScript.CheckInteraction() == false)
                        {
                            proceedFlag = false; alertType = AlertType.SideStatus;
                        }
                        //Action Menu -> not valid if  Player inactive
                        else if (GameManager.i.playerScript.status != ActorStatus.Active)
                        {
                            proceedFlag = false; alertType = AlertType.PlayerStatus;
                        }
                        else if (GameManager.i.optionScript.isActorRightMenu == false)
                        {
                            proceedFlag = false; alertType = AlertType.TutorialMenuUnavailable;
                        }
                        Actor actor = GameManager.i.dataScript.GetCurrentActor(actorSlotID, playerSide);
                        if (actor != null)
                        {
                            if (actor.Status != ActorStatus.Active)
                            {
                                proceedFlag = false; alertType = AlertType.ActorStatus; data = actor.actorID;
                            }
                            //proceed
                            if (proceedFlag == true)
                            {
                                //adjust position prior to sending
                                Vector3 position = transform.position;
                                position.x += 25;
                                position.y -= 50;
                                position    = Camera.main.ScreenToWorldPoint(position);
                                //actor
                                ModalGenericMenuDetails genericDetails = new ModalGenericMenuDetails()
                                {
                                    itemID              = actor.slotID,
                                    itemName            = actor.actorName,
                                    itemDetails         = string.Format("{0} ID {1}", actor.arc.name, actor.actorID),
                                    menuPos             = position,
                                    listOfButtonDetails = GameManager.i.actorScript.GetActorActions(actorSlotID),
                                    menuType            = ActionMenuType.Actor
                                };
                                //activate menu
                                GameManager.i.actionMenuScript.SetActionMenu(genericDetails);
                            }
                            else
                            {
                                //explanatory message
                                if (alertType != AlertType.None)
                                {
                                    GameManager.i.guiScript.SetAlertMessageModalOne(alertType, data);
                                }
                            }
                        }
                        else
                        {
                            Debug.LogError(string.Format("Invalid actor (Null) for actorSlotID {0}", actorSlotID));
                        }
                    }
                    break;
                }
            }
        }
    }
    /// <summary>
    /// Initialise Player Tool tip
    /// </summary>
    /// <param name="pos">Position of tooltip originator -> note as it's a UI element transform will be in screen units, not world units</param>
    public void SetTooltip(Vector3 pos)
    {
        bool isStatus     = false;
        bool isConditions = false;

        //open panel at start
        tooltipPlayerCanvas.gameObject.SetActive(true);
        tooltipPlayerObject.SetActive(true);
        GlobalSide playerSide = GameManager.i.sideScript.PlayerSide;

        //set opacity to zero (invisible)
        SetOpacity(0f);
        //set state of all items in tooltip window (Status and Conditions are switched on later only if present)

        playerName.gameObject.SetActive(true);
        playerStatus.gameObject.SetActive(false);
        playerConditions.gameObject.SetActive(false);
        playerStats.gameObject.SetActive(true);
        playerMulti_1.gameObject.SetActive(true);
        playerMulti_2.gameObject.SetActive(true);
        divider_1.gameObject.SetActive(true);
        divider_2.gameObject.SetActive(false);
        divider_3.gameObject.SetActive(false);   //true if both Status and Conditions texts are present
        divider_4.gameObject.SetActive(true);
        divider_5.gameObject.SetActive(true);
        //
        // - - - Name - - -
        //
        playerName.text = string.Format("{0}<b>PLAYER</b>{1}{2}{3}<size=110%><b>{4}</b></size>{5}", colourCancel, colourEnd, "\n", colourName, GameManager.i.playerScript.PlayerName, colourEnd);
        //
        // - - - Status - - -
        //
        if (GameManager.i.playerScript.status != ActorStatus.Active)
        {
            //activate UI components
            playerStatus.gameObject.SetActive(true);
            isStatus = true;
            switch (GameManager.i.playerScript.status)
            {
            case ActorStatus.Inactive:
                switch (GameManager.i.playerScript.inactiveStatus)
                {
                case ActorInactive.LieLow:
                    int numOfTurns = GameManager.i.actorScript.maxStatValue - GameManager.i.playerScript.Invisibility;
                    if (GameManager.i.playerScript.isLieLowFirstturn == true)
                    {
                        numOfTurns++;
                    }
                    playerStatus.text = string.Format("{0}<b>LYING LOW</b>{1}{2}Back in {3} turn{4}", colourNeutral, colourEnd, "\n", numOfTurns,
                                                      numOfTurns != 1 ? "s" : "");
                    break;

                case ActorInactive.Breakdown:
                    playerStatus.text = string.Format("{0}<b>BREAKDOWN (Stress)</b>{1}{2}Back next turn", colourNeutral, colourEnd, "\n");
                    break;
                }
                break;

            case ActorStatus.Captured:
                playerStatus.text = string.Format("{0}<b>CAPTURED</b>{1}{2}Whereabouts unknown", colourBad, colourEnd, "\n");
                break;

            default:
                playerStatus.text = string.Format("{0}<b>{1}</b>{2}", colourNeutral, GameManager.i.playerScript.status.ToString().ToUpper(), colourEnd);
                break;
            }
        }
        //
        // - - - Conditions - - -
        //
        if (GameManager.i.playerScript.CheckNumOfConditions(playerSide) > 0)
        {
            List <Condition> listOfConditions = GameManager.i.playerScript.GetListOfConditions(playerSide);
            if (listOfConditions != null)
            {
                playerConditions.gameObject.SetActive(true);
                StringBuilder builderCondition = new StringBuilder();
                foreach (Condition condition in listOfConditions)
                {
                    if (builderCondition.Length > 0)
                    {
                        builderCondition.AppendLine();
                    }
                    switch (condition.type.name)
                    {
                    case "Good":
                        builderCondition.AppendFormat("{0}{1}{2}", colourGood, condition.tag, colourEnd);
                        break;

                    case "Bad":
                        builderCondition.AppendFormat("{0}{1}{2}", colourBad, condition.tag, colourEnd);
                        break;

                    case "Neutral":
                        builderCondition.AppendFormat("{0}{1}{2}", colourNeutral, condition.tag, colourEnd);
                        break;

                    default:
                        Debug.LogError(string.Format("Invalid condition.type.name \"{0}\"", condition.type.name));
                        break;
                    }
                }
                isConditions          = true;
                playerConditions.text = builderCondition.ToString();
            }
            else
            {
                Debug.LogWarning("Invalid listOfConditions (Null)");
            }
        }
        //
        // - - - Dividers - - -
        //
        if (isStatus == true && isConditions == true)
        {
            divider_2.gameObject.SetActive(true);
        }
        if (isStatus == true || isConditions == true)
        {
            divider_3.gameObject.SetActive(true);
        }
        //
        // - - - Stats - - -
        //
        switch (playerSide.level)
        {
        case 1:
            //Authority
            StringBuilder builderAut = new StringBuilder();
            builderAut.AppendFormat("{0}Teams{1}{2}", colourAlert, colourEnd, "\n");
            builderAut.AppendFormat("<b>On Map<pos=70%>{0}</b>{1}", GameManager.i.dataScript.CheckTeamPoolCount(TeamPool.OnMap), "\n");
            builderAut.AppendFormat("<b>In Transit<pos=70%>{0}</b>{1}", GameManager.i.dataScript.CheckTeamPoolCount(TeamPool.InTransit), "\n");
            builderAut.AppendFormat("<b>Reserves<pos=70%>{0}</b>{1}", GameManager.i.dataScript.CheckTeamPoolCount(TeamPool.Reserve), "\n");
            playerStats.text = builderAut.ToString();
            break;

        case 2:
            //Resistance
            int           invisibility = GameManager.i.playerScript.Invisibility;
            int           mood         = GameManager.i.playerScript.GetMood();
            StringBuilder builderRes   = new StringBuilder();

            /*builderRes.AppendFormat("<size=110%><b>Invisibility<pos=70%>{0}{1}{2}</b></size>{3}", GameManager.instance.colourScript.GetValueColour(invisibility), invisibility, colourEnd, "\n");
             * builderRes.AppendFormat("<size=110%><b>Mood<pos=70%>{0}{1}{2}</b></size>", GameManager.instance.colourScript.GetValueColour(mood), mood, colourEnd);*/

            builderRes.AppendFormat("{0} <b>Invisibility<pos=60%>{1}</b>{2}", arrayOfIcons[0], GameManager.i.guiScript.GetNormalStars(invisibility), "\n");
            builderRes.AppendFormat("{0} <b>Mood<pos=60%>{1}</b>{2}", arrayOfIcons[1], GameManager.i.guiScript.GetNormalStars(mood), "\n");
            builderRes.AppendFormat("{0} <b>Innocence<pos=60%>{1}</b>", arrayOfIcons[2], GameManager.i.guiScript.GetNormalStars(GameManager.i.playerScript.Innocence));
            playerStats.text = builderRes.ToString();
            break;
        }
        //
        // - - - MultiPurpose 1 - - -
        //
        switch (playerSide.level)
        {
        case 1:
            //Authority
            playerMulti_1.text = "Placeholder";
            break;

        case 2:
            //Resistance -> Gear
            List <string> listOfGear = GameManager.i.playerScript.GetListOfGear();
            if (listOfGear != null && listOfGear.Count > 0)
            {
                StringBuilder builderGear = new StringBuilder();
                builderGear.AppendFormat("{0}<b>Gear</b>{1}", colourCancel, colourEnd);
                //gear in inventory
                foreach (string gearName in listOfGear)
                {
                    Gear gear = GameManager.i.dataScript.GetGear(gearName);
                    if (gear != null)
                    {
                        builderGear.AppendFormat("<b>{0}{1}{2}{3}</b>", "\n", colourNeutral, gear.tag, colourEnd);
                    }
                }
                playerMulti_1.text = builderGear.ToString();
            }
            else
            {
                playerMulti_1.text = string.Format("{0}<size=95%>No Gear</size>{1}", colourGrey, colourEnd);
            }
            break;
        }
        //
        // - - - MultiPurpose 2 (Secrets) - - -
        //
        List <Secret> listOfSecrets = GameManager.i.playerScript.GetListOfSecrets();

        if (listOfSecrets != null && listOfSecrets.Count > 0)
        {
            StringBuilder builderSecrets = new StringBuilder();
            builderSecrets.AppendFormat("{0}<b>Secrets</b>{1}", colourCancel, colourEnd);
            //loop secrets
            foreach (Secret secret in listOfSecrets)
            {
                //secrets shown as Red if known by other actors, green otherwise
                if (secret != null)
                {
                    if (secret.CheckNumOfActorsWhoKnow() > 0)
                    {
                        builderSecrets.AppendFormat("<b>{0}{1}{2}{3}</b>", "\n", colourBad, secret.tag, colourEnd);
                    }
                    else
                    {
                        builderSecrets.AppendFormat("<b>{0}{1}{2}{3}</b>", "\n", colourGood, secret.tag, colourEnd);
                    }
                }
            }
            playerMulti_2.text = builderSecrets.ToString();
        }
        else
        {
            playerMulti_2.text = string.Format("{0}<size=95%>No Secrets</size>{1}", colourGrey, colourEnd);
        }
        //Coordinates -> You need to send World (object.transform) coordinates
        Vector3 worldPos = pos;

        //update required to get dimensions as tooltip is dynamic
        Canvas.ForceUpdateCanvases();
        rectTransform = tooltipPlayerObject.GetComponent <RectTransform>();
        float height = rectTransform.rect.height;
        float width  = rectTransform.rect.width;

        //base y pos at zero (bottom of screen). Adjust up from there.
        worldPos.y += height + offset - 180;
        worldPos.x -= width / 10 + 180;
        //width
        if (worldPos.x + width / 2 >= Screen.width)
        {
            worldPos.x -= width / 2 + worldPos.x - Screen.width;
        }
        else if (worldPos.x - width / 2 <= 0)
        {
            worldPos.x += width / 2 - worldPos.x;
        }

        //set new position
        tooltipPlayerObject.transform.position = worldPos;
        Debug.LogFormat("[UI] TooltipPlayer.cs -> SetTooltip{0}", "\n");
    }
Exemple #25
0
    /// <summary>
    /// tooltip coroutine
    /// </summary>
    /// <returns></returns>
    private IEnumerator ShowTooltip()
    {
        float alphaCurrent;

        //delay before tooltip kicks in
        yield return(new WaitForSeconds(mouseOverDelay));

        //activate tool tip if mouse still over node
        if (onMouseFlag == true)
        {
            switch (menuType)
            {
            case ActionMenuType.Node:
            case ActionMenuType.NodeGear:
                //need to regularly update node details, rather than just at game start
                nodeObject = GameManager.i.dataScript.GetNodeObject(nodeID);
                if (nodeObject != null)
                {
                    node = nodeObject.GetComponent <Node>();
                }
                //do once
                while (GameManager.i.tooltipNodeScript.CheckTooltipActive() == false)
                {
                    List <string> activeList = new List <string>();
                    switch (GameManager.i.turnScript.currentSide.level)
                    {
                    case 1:
                        //Authority
                        activeList = GameManager.i.dataScript.GetActiveContactsAtNodeAuthority(nodeID);
                        break;

                    case 2:
                        activeList = GameManager.i.dataScript.GetActiveContactsAtNodeResistance(nodeID);
                        break;
                    }
                    List <EffectDataTooltip> effectsList = node.GetListOfOngoingEffectTooltips();
                    List <string>            targetList  = GameManager.i.targetScript.GetTargetTooltip(node.targetName, node.isTargetKnown);
                    List <string>            teamList    = new List <string>();
                    List <Team> listOfTeams = node.GetListOfTeams();
                    if (listOfTeams.Count > 0)
                    {
                        foreach (Team team in listOfTeams)
                        {
                            teamList.Add(string.Format("{0} team", team.arc.name));
                        }
                    }
                    //adjust position prior to sending (rectTransform is in World units)
                    Vector3 positionNode = rectTransform.position;
                    positionNode.x += 150;
                    positionNode.y -= 125;
                    positionNode    = Camera.main.ScreenToWorldPoint(positionNode);

                    NodeTooltipData nodeTooltip = new NodeTooltipData()
                    {
                        nodeName              = node.nodeName,
                        type                  = string.Format("{0} ID {1}", node.Arc.name, nodeID),
                        arrayOfStats          = new int[] { node.Stability, node.Support, node.Security },
                        listOfContactsCurrent = activeList,
                        listOfEffects         = effectsList,
                        listOfTeams           = teamList,
                        listOfTargets         = targetList,
                        tooltipPos            = positionNode
                    };
                    GameManager.i.tooltipNodeScript.SetTooltip(nodeTooltip);
                    yield return(null);
                }
                //fade in
                while (GameManager.i.tooltipNodeScript.GetOpacity() < 1.0)
                {
                    alphaCurrent  = GameManager.i.tooltipNodeScript.GetOpacity();
                    alphaCurrent += Time.deltaTime / mouseOverFade;
                    GameManager.i.tooltipNodeScript.SetOpacity(alphaCurrent);
                    yield return(null);
                }
                break;

            case ActionMenuType.Gear:
                Gear gear = GameManager.i.dataScript.GetGear(gearName);
                if (gear != null)
                {
                    GenericTooltipDetails details = GameManager.i.gearScript.GetGearTooltip(gear);
                    if (details != null)
                    {
                        //do once
                        while (GameManager.i.tooltipGenericScript.CheckTooltipActive() == false)
                        {
                            //adjust position prior to sending
                            Vector3            positionGear = rectTransform.position;
                            GenericTooltipData data         = new GenericTooltipData()
                            {
                                screenPos = positionGear, main = details.textMain, header = details.textHeader, details = details.textDetails
                            };
                            GameManager.i.tooltipGenericScript.SetTooltip(data);
                            yield return(null);

                            //fade in
                            while (GameManager.i.tooltipGenericScript.GetOpacity() < 1.0)
                            {
                                alphaCurrent  = GameManager.i.tooltipGenericScript.GetOpacity();
                                alphaCurrent += Time.deltaTime / mouseOverFade;
                                GameManager.i.tooltipGenericScript.SetOpacity(alphaCurrent);
                                yield return(null);
                            }
                        }
                    }
                }
                break;

            case ActionMenuType.Actor:
                GlobalSide side  = GameManager.i.sideScript.PlayerSide;
                Actor      actor = GameManager.i.dataScript.GetCurrentActor(actorSlotID, side);
                if (actor != null)
                {
                    //do once
                    while (GameManager.i.tooltipActorScript.CheckTooltipActive() == false)
                    {
                        //adjust position prior to sending
                        Vector3 positionActor = rectTransform.position;
                        positionActor.x += 70;
                        positionActor.y -= 100;
                        ActorTooltipData actorTooltip = actor.GetTooltipData(positionActor);
                        GameManager.i.tooltipActorScript.SetTooltip(actorTooltip, actor.slotID);
                        yield return(null);

                        //fade in
                        while (GameManager.i.tooltipActorScript.GetOpacity() < 1.0)
                        {
                            alphaCurrent  = GameManager.i.tooltipActorScript.GetOpacity();
                            alphaCurrent += Time.deltaTime / mouseOverFade;
                            GameManager.i.tooltipActorScript.SetOpacity(alphaCurrent);
                            yield return(null);
                        }
                    }
                }
                break;

            case ActionMenuType.Player:
                //do once
                while (GameManager.i.tooltipPlayerScript.CheckTooltipActive() == false)
                {
                    //adjust position prior to sending
                    Vector3 positionPlayer = rectTransform.position;
                    positionPlayer.x += 70;
                    positionPlayer.y -= 100;
                    GameManager.i.tooltipPlayerScript.SetTooltip(positionPlayer);
                    yield return(null);

                    //fade in
                    while (GameManager.i.tooltipPlayerScript.GetOpacity() < 1.0)
                    {
                        alphaCurrent  = GameManager.i.tooltipPlayerScript.GetOpacity();
                        alphaCurrent += Time.deltaTime / mouseOverFade;
                        GameManager.i.tooltipPlayerScript.SetOpacity(alphaCurrent);
                        yield return(null);
                    }
                }
                break;
            }
        }
    }
    public void Initialise()
    {
        int numArray;

        //
        // - - - ActorDraftSex (not stored in a collection)
        //
        numArray = arrayOfActorDraftSex.Length;
        if (numArray > 0)
        {
            Debug.LogFormat("[Loa] Initialise -> arrayOfActorDraftSex has {0} entries{1}", numArray, "\n");
        }
        else
        {
            Debug.LogWarning(" JointManager.cs -> InitialiseStart: No ActorDraftSex present");
        }
        //
        // - - - ActorDraftStatus (not stored in a collection)
        //
        numArray = arrayOfActorDraftStatus.Length;
        if (numArray > 0)
        {
            Debug.LogFormat("[Loa] Initialise -> arrayOfActorDraftStatus has {0} entries{1}", numArray, "\n");
        }
        else
        {
            Debug.LogWarning(" JointManager.cs -> InitialiseStart: No ActorDraftStatus present");
        }
        //
        // - - - GlobalSide - - -
        //
        int num = arrayOfGlobalSide.Length;

        if (num > 0)
        {
            for (int i = 0; i < num; i++)
            {
                GlobalSide assetSO = arrayOfGlobalSide[i];
                //pick out and assign the ones required for fast acess, ignore the rest.
                //Also dynamically assign GlobalSide.level values (0/1/2).
                switch (assetSO.name)
                {
                case "Authority":
                    sideAuthority = assetSO;
                    assetSO.level = 1;
                    break;

                case "Resistance":
                    sideResistance = assetSO;
                    assetSO.level  = 2;
                    break;

                default:
                    Debug.LogWarningFormat("Invalid side \"{0}\"", assetSO.name);
                    break;
                }
            }
            //error check
            Debug.Assert(sideAuthority != null, "Invalid sideAuthority (Null)");
            Debug.Assert(sideResistance != null, "Invalid sideResistance (Null)");
        }
        //
        // - - - Traits
        //
        Dictionary <string, Trait> dictOfTraits = ToolManager.i.toolDataScript.GetDictOfTraits();

        if (dictOfTraits != null)
        {
            numArray = arrayOfTraits.Length;
            if (numArray > 0)
            {
                Debug.LogFormat("[Loa] Initialise -> arrayOfTraits has {0} entries{1}", numArray, "\n");
            }
            else
            {
                Debug.LogWarning(" LoadManager.cs -> Initialise: No Trait present");
            }
            //add to dictionary
            for (int i = 0; i < numArray; i++)
            {
                Trait trait = arrayOfTraits[i];
                if (trait != null)
                {
                    try
                    { dictOfTraits.Add(trait.name, trait); }
                    catch (ArgumentException)
                    { Debug.LogWarningFormat("Duplicate record exists in dictOfTraits for {0}", trait); }
                }
                else
                {
                    Debug.LogWarningFormat("Invalid Trait (Null) for arrayOfTraits[{0}]", i);
                }
            }
        }
        else
        {
            Debug.LogError("Invalid dictOfTraits (Null)");
        }
        //
        // - - - ActorArcs
        //
        Dictionary <string, ActorArc> dictOfActorArcs = ToolManager.i.toolDataScript.GetDictOfActorArcs();

        if (dictOfActorArcs != null)
        {
            numArray = arrayOfActorArcs.Length;
            if (numArray > 0)
            {
                Debug.LogFormat("[Loa] Initialise -> arrayOfActorArcs has {0} entries{1}", numArray, "\n");
            }
            else
            {
                Debug.LogWarning(" LoadManager.cs -> Initialise: No ActorArc present");
            }
            //add to dictionary
            for (int i = 0; i < numArray; i++)
            {
                ActorArc arc = arrayOfActorArcs[i];
                if (arc != null)
                {
                    try
                    { dictOfActorArcs.Add(arc.name, arc); }
                    catch (ArgumentException)
                    { Debug.LogWarningFormat("Duplicate record exists in dictOfActorArcs for {0}", arc); }
                }
                else
                {
                    Debug.LogWarningFormat("Invalid ActorArc (Null) for arrayOfActorArcs[{0}]", i);
                }
            }
        }
        else
        {
            Debug.LogError("Invalid dictOfActorArcs (Null)");
        }
    }
    /// <summary>
    /// Open Review UI
    /// </summary>
    private void SetReviewUI(ReviewInputData details)
    {
        bool errorFlag = false;

        isOutcome = false;
        //reset timer (may have changed previously if player skipped review)
        reviewWaitTime = reviewWaitTimerDefault;
        Debug.LogFormat("[UI] ModalReviewUI.cs -> OpenReviewUI{0}", "\n");
        //set modal status
        GameManager.i.guiScript.SetIsBlocked(true);
        //activate main panel
        panelObject.SetActive(true);
        reviewObject.SetActive(true);
        headerObject.SetActive(true);
        GlobalSide playerSide = GameManager.i.sideScript.PlayerSide;

        //buttons
        buttonReview.gameObject.SetActive(true);
        buttonExit.gameObject.SetActive(false);
        buttonHelpOpen.gameObject.SetActive(true);
        buttonHelpClose.gameObject.SetActive(false);
        //outcome symbols
        outcomeLeft.gameObject.SetActive(false);
        outcomeRight.gameObject.SetActive(false);
        //tooltips
        InitialiseHelp();
        //set up modal panel & buttons to be side appropriate
        switch (playerSide.level)
        {
        case 1:
            panelBackground.sprite = GameManager.i.sideScript.inventory_background_Authority;
            panelHeader.sprite     = GameManager.i.sideScript.header_background_Authority;
            //set button sprites
            buttonReview.GetComponent <Image>().sprite = GameManager.i.sideScript.button_Authority;
            buttonExit.GetComponent <Image>().sprite   = GameManager.i.sideScript.button_Authority;
            //set sprite transitions
            SpriteState spriteStateAuthority = new SpriteState();
            spriteStateAuthority.highlightedSprite = GameManager.i.sideScript.button_highlight_Authority;
            spriteStateAuthority.pressedSprite     = GameManager.i.sideScript.button_Click;
            buttonReview.spriteState = spriteStateAuthority;
            buttonExit.spriteState   = spriteStateAuthority;
            break;

        case 2:
            panelBackground.sprite = GameManager.i.sideScript.inventory_background_Resistance;
            panelHeader.sprite     = GameManager.i.sideScript.header_background_Resistance;
            //set button sprites
            buttonReview.GetComponent <Image>().sprite = GameManager.i.sideScript.button_Resistance;
            buttonExit.GetComponent <Image>().sprite   = GameManager.i.sideScript.button_Resistance;
            //set sprite transitions
            SpriteState spriteStateRebel = new SpriteState();
            spriteStateRebel.highlightedSprite = GameManager.i.sideScript.button_highlight_Resistance;
            spriteStateRebel.pressedSprite     = GameManager.i.sideScript.button_Click;
            buttonReview.spriteState           = spriteStateRebel;
            buttonExit.spriteState             = spriteStateRebel;
            break;

        default:
            Debug.LogError(string.Format("Invalid side \"{0}\"", playerSide.name));
            break;
        }
        //set texts
        textHeader.text = "Peer Review";
        textTop.text    = "You are about to be assessed by your Peers";
        textBottom.text = "Press SPACE, or the COMMENCE REVIEW button";
        if (details != null)
        {
            //loop array and set options
            for (int i = 0; i < arrayOfOptions.Length; i++)
            {
                //valid option?
                if (arrayOfOptions[i] != null)
                {
                    if (arrayOfInteractions[i] != null)
                    {
                        if (arrayOfOptions[i] != null)
                        {
                            //activate option
                            arrayOfOptions[i].SetActive(true);
                            //populate option data
                            arrayOfInteractions[i].optionImage.sprite = details.arrayOfOptions[i].sprite;
                            arrayOfInteractions[i].textUpper.text     = details.arrayOfOptions[i].textUpper;
                            arrayOfInteractions[i].optionData         = details.arrayOfOptions[i].optionID;
                            //result
                            arrayOfInteractions[i].textResult.gameObject.SetActive(false);
                            arrayOfInteractions[i].textResult.text = details.arrayOfOptions[i].textLower;
                            //tooltip data -> sprites & titles (identical)
                            if (arrayOfTooltipsSprites[i] != null)
                            {
                                if (details.arrayOfTooltipsSprite[i] != null)
                                {
                                    //sprites
                                    arrayOfTooltipsSprites[i].tooltipHeader  = details.arrayOfTooltipsSprite[i].textHeader;
                                    arrayOfTooltipsSprites[i].tooltipMain    = details.arrayOfTooltipsSprite[i].textMain;
                                    arrayOfTooltipsSprites[i].tooltipDetails = details.arrayOfTooltipsSprite[i].textDetails;
                                    arrayOfTooltipsSprites[i].x_offset       = 55;
                                    arrayOfTooltipsSprites[i].y_offset       = -10;
                                    //titles
                                    arrayOfTooltipsTitles[i].tooltipHeader  = details.arrayOfTooltipsSprite[i].textHeader;
                                    arrayOfTooltipsTitles[i].tooltipMain    = details.arrayOfTooltipsSprite[i].textMain;
                                    arrayOfTooltipsTitles[i].tooltipDetails = details.arrayOfTooltipsSprite[i].textDetails;
                                    arrayOfTooltipsTitles[i].x_offset       = 55;
                                    arrayOfTooltipsTitles[i].y_offset       = 50;
                                }
                                else
                                {
                                    Debug.LogWarningFormat("Invalid tooltipDetailsSprite (Null) for arrayOfOptions[{0}]", i);
                                }
                            }
                            else
                            {
                                Debug.LogError(string.Format("Invalid GenericTooltipUI (Null) in arrayOfTooltips[{0}]", i));
                            }
                            //tooltip data -> results
                            if (arrayOfTooltipsResults[i] != null)
                            {
                                if (details.arrayOfTooltipsResult[i] != null)
                                {
                                    arrayOfTooltipsResults[i].tooltipHeader  = details.arrayOfTooltipsResult[i].textHeader;
                                    arrayOfTooltipsResults[i].tooltipMain    = details.arrayOfTooltipsResult[i].textMain;
                                    arrayOfTooltipsResults[i].tooltipDetails = details.arrayOfTooltipsResult[i].textDetails;
                                    arrayOfTooltipsResults[i].x_offset       = 55;
                                    arrayOfTooltipsResults[i].y_offset       = 15;
                                }
                                else
                                {
                                    Debug.LogWarningFormat("Invalid tooltipResults (Null) in arrayOfTooltipResults[{0}]", i);
                                }
                            }
                            else
                            {
                                Debug.LogWarningFormat("Invalid arrayOfTooltipsResults[{0}] (Null)", i);
                            }
                        }
                        else
                        {
                            //invalid option, switch off
                            arrayOfOptions[i].SetActive(false);
                        }
                    }
                    else
                    {
                        //error -> Null Interaction data
                        Debug.LogErrorFormat("Invalid arrayOfInventoryOptions[\"{0}\"] optionInteraction (Null)", i);
                        errorFlag = true;
                        break;
                    }
                }
                else
                {
                    //error -> Null array
                    Debug.LogErrorFormat("Invalid arrayOfInventoryOptions[{0}] (Null)", i);
                    errorFlag = true;
                    break;
                }
            }
        }
        else
        {
            Debug.LogError("Invalid ReviewInputData (Null)");
            errorFlag = true;
        }
        //error outcome message if there is a problem
        if (errorFlag == true)
        {
            reviewObject.SetActive(false);
            //create an outcome window to notify player
            ModalOutcomeDetails outcomeDetails = new ModalOutcomeDetails();
            outcomeDetails.textTop    = "There has been a hiccup and the information isn't available";
            outcomeDetails.textBottom = "We've called the WolfMan. He's on his way";
            outcomeDetails.side       = playerSide;
            EventManager.i.PostNotification(EventType.OutcomeOpen, this, outcomeDetails, "ModalInventoryUI.cs -> SetInventoryUI");
        }
        else
        {
            //all good, review window displayed
            GameManager.i.inputScript.ModalReviewState = ModalReviewSubState.Open;
            votesFor       = details.votesFor;
            votesAgainst   = details.votesAgainst;
            votesAbstained = details.votesAbstained;
            ModalStateData package = new ModalStateData()
            {
                mainState = ModalSubState.Review
            };
            GameManager.i.inputScript.SetModalState(package);
            Debug.LogFormat("[UI] ModalInventoryUI.cs -> SetInventoryUI{0}", "\n");
            //flash review button
            isFlashReviewButton = true;
            StartCoroutine("ReviewButton");
        }
    }
Exemple #28
0
    /// <summary>
    /// Mouse click -> Right: Actor Action Menu
    /// </summary>
    public void OnPointerClick(PointerEventData eventData)
    {
        GlobalSide playerSide  = GameManager.i.sideScript.PlayerSide;
        bool       proceedFlag = true;
        AlertType  alertType   = AlertType.None;

        switch (eventData.button)
        {
        case PointerEventData.InputButton.Left:
            if (GameManager.i.optionScript.isPlayerLeftMenu == true)
            {
                //player review
                TabbedUIData tabbedDetails = new TabbedUIData()
                {
                    side   = playerSide,
                    who    = TabbedUIWho.Player,
                    slotID = 0,
                };
                EventManager.i.PostNotification(EventType.TabbedOpen, this, tabbedDetails, "PlayerClickUI.cs -> OnPointerClick");
            }
            else
            {
                GameManager.i.guiScript.SetAlertMessageModalOne(AlertType.TutorialDossierUnavailable);
            }
            break;

        case PointerEventData.InputButton.Right:
            if (GameManager.i.guiScript.CheckIsBlocked() == false)
            {
                //Action Menu -> not valid if AI is active for side
                if (GameManager.i.sideScript.CheckInteraction() == false)
                {
                    proceedFlag = false; alertType = AlertType.SideStatus;
                }
                if (GameManager.i.playerScript.status != ActorStatus.Active)
                {
                    proceedFlag = false; alertType = AlertType.PlayerStatus;
                }
                if (GameManager.i.optionScript.isPlayerRightMenu == false)
                {
                    proceedFlag = false; alertType = AlertType.TutorialMenuUnavailable;
                }

                /*//Action Menu -> not valid if  Player inactive
                 * else if (GameManager.instance.playerScript.status != ActorStatus.Active)
                 * { proceedFlag = false; alertType = AlertType.PlayerStatus; }*/
                //proceed
                if (proceedFlag == true)
                {
                    //adjust position prior to sending
                    Vector3 position = transform.position;
                    position.x += 25;
                    position.y -= 50;
                    position    = Camera.main.ScreenToWorldPoint(position);
                    //actor
                    ModalGenericMenuDetails details = new ModalGenericMenuDetails()
                    {
                        itemID              = 1,
                        itemName            = GameManager.i.playerScript.PlayerName,
                        itemDetails         = menuHeaderRightClick,
                        menuPos             = position,
                        listOfButtonDetails = GameManager.i.actorScript.GetPlayerActions(),
                        menuType            = ActionMenuType.Player
                    };
                    //close Player tooltip
                    GameManager.i.tooltipPlayerScript.CloseTooltip();
                    //activate menu
                    GameManager.i.actionMenuScript.SetActionMenu(details);
                }
                else
                {
                    //explanatory message
                    if (alertType != AlertType.None)
                    {
                        GameManager.i.guiScript.SetAlertMessageModalOne(alertType);
                    }
                }
            }
            break;

        default:
            Debug.LogWarningFormat("Unknown InputButton \"{0}\"", eventData.button);
            break;
        }
    }
    /*/// <summary>
     * /// event handler
     * /// </summary>
     * /// <param name="eventType"></param>
     * /// <param name="Sender"></param>
     * /// <param name="Param"></param>
     * public void OnEvent(EventType eventType, Component Sender, object Param = null)
     * {
     *  //detect event type
     *  switch (eventType)
     *  {
     *      case EventType.ChangeColour:
     *          SetColours();
     *          break;
     *      default:
     *          Debug.LogError(string.Format("Invalid eventType {0}{1}", eventType, "\n"));
     *          break;
     *  }
     * }*/

    /*/// <summary>
     * /// Set colour palette for tooltip
     * /// </summary>
     * public void SetColours()
     * {
     *  colourDefault = GameManager.instance.colourScript.GetColour(ColourType.whiteText);
     *  colourNormal = GameManager.instance.colourScript.GetColour(ColourType.normalText);
     *  colourAlert = GameManager.instance.colourScript.GetColour(ColourType.salmonText);
     *  colourResistance = GameManager.instance.colourScript.GetColour(ColourType.blueText);
     *  colourBad = GameManager.instance.colourScript.GetColour(ColourType.badText);
     *  colourNeutral = GameManager.instance.colourScript.GetColour(ColourType.neutralText);
     *  colourGood = GameManager.instance.colourScript.GetColour(ColourType.goodText);
     *  colourEnd = GameManager.instance.colourScript.GetEndTag();
     * }*/


    #region RemoveSecretFromAll
    /// <summary>
    /// Removes a given secret from all actors (OnMap and Reserve) and player. If calling for a deleted secret then set to true, otherwise, for a normal revealed secret situation, default false
    /// This ensures that if a secret is deleted from an actor who is currently blackmailing then their blackmailer status is removed if they end up with no secrets remaining
    /// Revealed secrets may trigger an investigation, deleted ones not
    /// Returns true if successfully removed secret/s, false otherwise
    /// </summary>
    /// <param name="secretID"></param>
    public bool RemoveSecretFromAll(string secretName, bool isDeletedSecret = false)
    {
        GlobalSide side      = GameManager.i.sideScript.PlayerSide;
        Secret     secret    = GameManager.i.dataScript.GetSecret(secretName);
        bool       isSuccess = true;

        if (secret != null)
        {
            //remove from player
            GameManager.i.playerScript.RemoveSecret(secretName);
            if (isDeletedSecret == true)
            {
                //message
                string playerMsg = string.Format("Player loses secret \"{0}\"", secret.tag);
                GameManager.i.messageScript.PlayerSecret(playerMsg, secret, false);
            }
            //remove actors from secret list
            secret.RemoveAllActors();
            //Create a list of all current actors plus all actors in Reserve
            List <Actor> listOfActors = new List <Actor>();
            //add current actors
            Actor[] arrayOfActors = GameManager.i.dataScript.GetCurrentActorsFixed(side);
            if (arrayOfActors != null)
            {
                for (int i = 0; i < arrayOfActors.Length; i++)
                {
                    //check actor is present in slot (not vacant)
                    if (GameManager.i.dataScript.CheckActorSlotStatus(i, side) == true)
                    {
                        listOfActors.Add(arrayOfActors[i]);
                    }
                }
            }
            else
            {
                Debug.LogWarning("Invalid arrayOfActors (Null)");
            }
            //add reserve actors
            List <int> listOfReserveActors = GameManager.i.dataScript.GetActorList(GameManager.i.sideScript.PlayerSide, ActorList.Reserve);
            if (listOfReserveActors.Count > 0)
            {
                for (int i = 0; i < listOfReserveActors.Count; i++)
                {
                    Actor actor = GameManager.i.dataScript.GetActor(listOfReserveActors[i]);
                    if (actor != null)
                    {
                        listOfActors.Add(actor);
                    }
                    else
                    {
                        Debug.LogWarningFormat("Invalid actor (Null) for actorID {0}", listOfReserveActors[i]);
                    }
                }
            }
            //loop all actors
            foreach (Actor actor in listOfActors)
            {
                if (actor != null)
                {
                    actor.RemoveSecret(secretName);
                    //blackmail check -> if actor is blackmailing and they end up with zero secrets then the condition is removed
                    if (isDeletedSecret == true)
                    {
                        //message (any situation where a blackmail check is needed is going to be a deleted secret, hence the need for a message
                        string msgText = string.Format("{0} loses secret \"{1}\"", actor.arc.name, secret.tag);
                        GameManager.i.messageScript.ActorSecret(msgText, actor, secret, false);
                        if (actor.CheckConditionPresent(conditionBlackmail) == true)
                        {
                            if (actor.CheckNumOfSecrets() == 0)
                            {
                                actor.RemoveCondition(conditionBlackmail, "Secret no longer has any effect");
                                //additional explanatory message (why has condition gone?)
                                string blackText = string.Format("{0} can no longer Blackmail (no Secret)", actor.arc.name);
                                string reason    = "The secret they hold has no value";
                                GameManager.i.messageScript.ActorBlackmail(blackText, actor, secret, true, reason);
                            }
                        }
                    }
                }
            }
            //chance Investigation launched
            if (GameManager.i.playerScript.CheckInvestigationPossible() == true)
            {
                //revealed secrets only (no investigation possible for deleted secrets)
                if (isDeletedSecret == false)
                {
                    string text;
                    int    rnd      = Random.Range(0, 100);
                    int    chance   = GameManager.i.playerScript.chanceInvestigation;
                    int    gameTurn = GameManager.i.turnScript.Turn;
                    if (rnd < chance)
                    {
                        //create a new investigation
                        Investigation invest = new Investigation()
                        {
                            reference = string.Format("{0}{1}", gameTurn, secret.name),
                            tag       = secret.investigationTag,
                            evidence  = secret.investigationEvidence,
                            turnStart = gameTurn,
                            lead      = GameManager.i.hqScript.GetRandomHqPosition(),
                            city      = GameManager.i.cityScript.GetCityName(),
                            status    = InvestStatus.Ongoing,
                            outcome   = InvestOutcome.None
                        };
                        //add to player's list
                        GameManager.i.playerScript.AddInvestigation(invest);
                        //stats
                        GameManager.i.dataScript.StatisticIncrement(StatType.InvestigationsLaunched);
                        //msgs
                        Debug.LogFormat("[Rnd] SecretManager.cs -> RemoveSecretFromAll: INVESTIGATION commences, need < {0}, rolled {1}{2}", chance, rnd, "\n");
                        text = "INVESTIGATION commences";
                        GameManager.i.messageScript.GeneralRandom(text, "Investigation", chance, rnd, true, "rand_4");
                        text = string.Format("Investigation into Player {0} launched by {1}", invest.tag, invest.lead);
                        GameManager.i.messageScript.InvestigationNew(text, invest);
                        //history
                        GameManager.i.dataScript.AddHistoryPlayer(new HistoryActor()
                        {
                            text = string.Format("Investigation Launched into your conduct ({0})", secret.investigationTag)
                        });
                        //outcome (message pipeline)
                        text = string.Format("<size=120%>INVESTIGATION</size>{0}Launched into your{1}{2}", "\n", "\n", GameManager.Formatt(invest.tag, ColourType.neutralText));
                        string bottomText = "Unknown";
                        Actor  actor      = GameManager.i.dataScript.GetHqHierarchyActor(invest.lead);
                        if (actor == null)
                        {
                            Debug.LogErrorFormat("Invalid HQ actor for ActorHQ invest.lead \"{0}\"", GameManager.i.hqScript.GetHqTitle(invest.lead));
                            bottomText = string.Format("HQ have assigned their {0} to lead the investigation{1}",
                                                       actor.actorName, GameManager.Formatt(GameManager.i.hqScript.GetHqTitle(invest.lead), ColourType.salmonText).ToUpper(), "\n");
                        }
                        else
                        {
                            bottomText = string.Format("HQ have assigned{0}{1}, {2}{3}to lead the investigation{4}", "\n", actor.actorName,
                                                       GameManager.Formatt(GameManager.i.hqScript.GetHqTitle(invest.lead), ColourType.salmonText).ToUpper(), "\n", "\n");
                        }
                        ModalOutcomeDetails outcomeDetails = new ModalOutcomeDetails
                        {
                            textTop    = text,
                            textBottom = bottomText,
                            sprite     = GameManager.i.spriteScript.investigationSprite,
                            isAction   = false,
                            side       = GameManager.i.sideScript.PlayerSide,
                            type       = MsgPipelineType.InvestigationLaunched,
                            help0      = "invest_10"
                        };
                        if (GameManager.i.guiScript.InfoPipelineAdd(outcomeDetails) == false)
                        {
                            Debug.LogWarningFormat("Investigation Launched InfoPipeline message FAILED to be added to dictOfPipeline");
                        }
                    }
                    else
                    {
                        //msgs
                        Debug.LogFormat("[Rnd] SecretManager.cs -> RemoveSecretFromAll: No Investigation, need < {0}, rolled {1}{2}", chance, rnd, "\n");
                        text = "No INVESTIGATION";
                        GameManager.i.messageScript.GeneralRandom(text, "Investigation", chance, rnd, false, "rand_4");
                    }
                }
            }
            else
            {
                Debug.LogFormat("[Inv] SecretManager.cs -> RemoveSecretFromAll: Max number of investigations already, new Investigation not possible{0}", "\n");
            }
        }
        else
        {
            isSuccess = false;
            Debug.LogWarningFormat("Invalid secret (Null) for secret {0} -> Not removed", secretName);
        }
        return(isSuccess);
    }
    //
    // - - - Debug - - -
    //

    /// <summary>
    /// debug method to display data
    /// </summary>
    /// <returns></returns>
    public string DebugDisplaySecretData()
    {
        StringBuilder builder = new StringBuilder();
        GlobalSide    side    = GameManager.i.sideScript.PlayerSide;
        Dictionary <string, Secret> dictOfSecrets = GameManager.i.dataScript.GetDictOfSecrets();

        builder.AppendFormat(" Secret Data {0}{1}", "\n", "\n");
        //main dictionary data
        builder.Append("- dictOfSecrets");
        if (dictOfSecrets != null)
        {
            if (dictOfSecrets.Count > 0)
            {
                foreach (var secret in dictOfSecrets)
                {
                    builder.AppendFormat("{0} {1} (\"{2}\"), {3}, Known: {4}", "\n", secret.Key, secret.Value.tag, secret.Value.status, secret.Value.CheckNumOfActorsWhoKnow());
                }
            }
            else
            {
                builder.AppendFormat("{0} No records", "\n");
            }
        }
        else
        {
            Debug.LogWarning("Invalid dictOfSecrets (Null)");
        }
        //player secrets data
        builder.AppendFormat("{0}{1}- listOfPlayerSecrets", "\n", "\n");
        builder.Append(DisplaySecretList(GameManager.i.dataScript.GetListOfPlayerSecrets()));
        //organisation secrets data
        builder.AppendFormat("{0}{1}- listOfOrganisationSecrets", "\n", "\n");
        builder.Append(DisplaySecretList(GameManager.i.dataScript.GetListOfOrganisationSecrets()));
        //story secrets data
        builder.AppendFormat("{0}{1}- listOfStorySecrets", "\n", "\n");
        builder.Append(DisplaySecretList(GameManager.i.dataScript.GetListOfStorySecrets()));
        //revealed secrets data
        builder.AppendFormat("{0}{1}- listOfRevealedSecrets", "\n", "\n");
        builder.Append(DisplaySecretList(GameManager.i.dataScript.GetListOfRevealedSecrets()));
        //deleted secrets data
        builder.AppendFormat("{0}{1}- listOfDeletedSecrets", "\n", "\n");
        builder.Append(DisplaySecretList(GameManager.i.dataScript.GetListOfDeletedSecrets()));
        //player data
        builder.AppendFormat("{0}{1}- PLAYER", "\n", "\n");
        builder.Append(GameManager.i.playerScript.DebugDisplaySecrets());
        //actor data
        for (int i = 0; i < GameManager.i.actorScript.maxNumOfOnMapActors; i++)
        {
            //actor present
            if (GameManager.i.dataScript.CheckActorSlotStatus(i, side) == true)
            {
                Actor actor = GameManager.i.dataScript.GetCurrentActor(i, side);
                if (actor != null)
                {
                    builder.AppendFormat("{0}{1}- {2} ID {3}", "\n", "\n", actor.arc.name, actor.actorID);
                    builder.Append(actor.DebugDisplaySecrets());
                }
                else
                {
                    Debug.LogWarningFormat("Invalid actor (Null) for actorSlotID {0}", i);
                }
            }
        }

        return(builder.ToString());
    }