Exemple #1
0
    public void DisplayConsoleText(string direction, float startPosition, float endPosition, float swipingTime, float distance, float fingerUpY = 0)
    {
        bool isInNavbarArea = navigationBarSwipingScript.CheckIfSwipeBeginInNavbarArea(direction, startPosition, fingerUpY, navigationBarSwipingScript.navBarScreenAreaCorners);
        bool isWindowOpen   = navigationBarBaseScript.IsWindowOpen;

        string outputConsoleString = $"- Swipe direction:\t<color=green>{direction}</color>\n" +
                                     $"- Start position:\t<color=green>({startPosition})</color>\n" +
                                     $"- End position:\t<color=green>({endPosition})</color>\n" +
                                     $"- Swiping time:\t<color=green>{swipingTime}s</color>\n" +
                                     $"- Swipe distance:\t<color=green>{distance}</color>\n" +
                                     $"- Swipe inside:\t<color=green>{isInNavbarArea}</color>\n" +
                                     $"\n";

        // TODO: rewrite swiping right/left system , insteed use scrolling panel like in the inventory but horizontally ON
        if (isInNavbarArea)
        {
            if (isWindowOpen)
            {
                if (direction == "Right" || direction == "Left")
                {
                    outputConsoleString += GeneratePlayerBehaviorString(wantSwipe: true);
                }
                else if (direction == "Down")
                {
                    // window is already opened, swipe up shouldnt do nothink only swipe down to close is avaiable move
                    outputConsoleString += GeneratePlayerBehaviorString(wantHide: true);
                }
                else
                {
                    outputConsoleString += GeneratePlayerBehaviorString(notAllowedActionCode: 1);
                }
            }
            else
            {
                if (direction == "Right" || direction == "Left")
                {
                    outputConsoleString += GeneratePlayerBehaviorString(wantSwipe: true);
                }
                else if (direction == "Up")
                {
                    // window is already closed, swipe udown shouldnt do nothink only swipe up to open is available
                    outputConsoleString += GeneratePlayerBehaviorString(wantOpen: true);
                }
                else
                {
                    outputConsoleString += GeneratePlayerBehaviorString(notAllowedActionCode: 2);
                }
            }
        }
        else
        {
            // player dont grab navbar or dont slide in navbar area ? wait for a new attempt ;d
            outputConsoleString += GeneratePlayerBehaviorString(notAllowedActionCode: 3);
        }

        this.transform.GetChild(0).GetComponent <TextMeshProUGUI>().SetText(outputConsoleString);
    }