Beispiel #1
0
    private void Awake()
    {
        _toggles         = ObjectsLibrary.Find("ImageCheatSheet/ObjectSelected/Shape").GetComponentsInChildren <Toggle>();
        _currentWallType = WallsUtils.Walltype.WC; // TODO Set null

        Transform wallObjectProperties = WallObjectProperties.Find("ImageCheatSheet/Properties");
        Transform wallObjectContent    = WallObjectProperties.Find("ImageCheatSheet/ObjectSelected");

        _wallObjectId = wallObjectProperties.Find("Id").gameObject;
        _time         = wallObjectProperties.Find("Time").gameObject;
        // _backgroundImage = wallObjectContent.Find("Shape/ImageBackground").gameObject;
        _shapeImage = wallObjectContent.Find("Shape/ImageBackground/WallImage").gameObject;
        _dodgeImage = wallObjectContent.Find("Dodge/ImageBackground").gameObject;

        _coinImageBackground = wallObjectContent.Find("Coin/ImageBackground").gameObject;
        _coinImage           = wallObjectContent.Find("Coin/ImageBackground/Image").gameObject;

        _currentTab = wallObjectContent.Find("Shape").gameObject;
        _currentTab.SetActive(true);

        WallShape   = new WallShape();
        WallHit     = new WallHit();
        WallDodge   = new WallDodge();
        WallCoin    = new Coin();
        WallCustom  = new WallCustom();
        CurrentWall = WallShape;
    }
Beispiel #2
0
    public int GetPositionOfCharToChange(WallsUtils.Walltype wallType, string name)
    {
        switch (wallType)
        {
        case WallsUtils.Walltype.NONE:
            break;

        case WallsUtils.Walltype.WP:
            return(WallShape.GetPositionOfCharToChange(name));

        case WallsUtils.Walltype.WA:
            break;

        case WallsUtils.Walltype.WH:
            return(WallHit.GetPositionOfCharToChange(name));

        case WallsUtils.Walltype.WC:
            break;

        case WallsUtils.Walltype.CN:
            break;

        case WallsUtils.Walltype.EV:
            break;

        default:
            break;
        }

        return(-1);
    }
Beispiel #3
0
    public static string FlipWallObject(string id)
    {
        string[] splitedName = id.ToUpper().Split('.');
        string   flippedID   = "";

        flippedID = id;  // sets default (original panel) ... for cases WC, EV

        try
        {
            WallsUtils.Walltype wallType = (WallsUtils.Walltype)Enum.Parse(typeof(WallsUtils.Walltype), splitedName[0]);

            string wallId = splitedName[1];
            switch (wallType)
            {
            case WallsUtils.Walltype.WP:
                wallId = flipObject(wallId);

                char[] wallIdChars = wallId.ToCharArray();

                char temporalChar = wallIdChars[1];
                wallIdChars[1] = wallIdChars[2];
                wallIdChars[2] = temporalChar;

                wallId    = new string(wallIdChars);
                flippedID = "WP." + wallId;

                break;

            case WallsUtils.Walltype.WA:
            case WallsUtils.Walltype.WH:
                flippedID = flipObject(id);

                break;

            case WallsUtils.Walltype.CN:

                int invertX = -(Int32.Parse(splitedName[1]));

                flippedID = splitedName[0] + "." + invertX.ToString() + "." + splitedName[2];
                break;

            case WallsUtils.Walltype.WC:
            case WallsUtils.Walltype.EV:
                break;
            }
        }
        catch (Exception e)
        {
            Log.AddLine("Bad Wall Id -> " + id + " Error : " + e.StackTrace);
            Debug.Log("try catch caught");
        }

        // Method assumes the mirror of a valid panel should be valid, but if one wants to recheck
        // validity, this would validate and conditionally return to default shape.

        // if (!WallsUtils.CheckWallId(wallType, strPanel)) wallObject.WallObjectId = savedPanelCode;

        return(flippedID);
    }
Beispiel #4
0
    private void CheckHit(WallsUtils.Walltype type, string id)
    {
        if (WallsUtils.CheckWallId(type, id))
        {
            _mainColor      = ColorHit;
            _secundaryColor = PressedColorHit;

            SetTextToggle("H");
        }
    }
Beispiel #5
0
    private void CheckCustom(WallsUtils.Walltype type, string id)
    {
        if (WallsUtils.CheckWallId(type, id))
        {
            _mainColor      = ColorCustom;
            _secundaryColor = PressedColorCustom;

            SetTextToggle("C");
        }
    }
Beispiel #6
0
    public void CheckWallId(string id)
    {
        _mainColor      = ColorNull;
        _secundaryColor = PressedColorNull;
        SetTextToggle("?");

        //Pose:    WP.[L|C|R][nn][?][U|D]
        //Custom:  WC.[L|C|R][xxxx]
        //Hit:     WH.[L|C|R][L|B|R][U|D]
        //Avoid:   WA.xxxx.t
        //Coin:    CN.xx.yy
        string[] splitedName = id.ToUpper().Split('.');

        try {
            WallsUtils.Walltype wallType = (WallsUtils.Walltype)Enum.Parse(typeof(WallsUtils.Walltype), splitedName[0]);
            string wallId = splitedName[1];
            switch (wallType)
            {
            case WallsUtils.Walltype.WP:
                CheckPose(wallType, wallId);
                break;

            case WallsUtils.Walltype.WA:
                string time = splitedName[2];
                CheckAvoid(wallId, time);
                break;

            case WallsUtils.Walltype.WH:
                CheckHit(wallType, wallId);
                break;

            case WallsUtils.Walltype.WC:
                CheckCustom(wallType, wallId);
                break;

            case WallsUtils.Walltype.CN:
                string x = splitedName[1];
                string y = splitedName[2];
                CheckCoins(x, y);
                break;

            case WallsUtils.Walltype.EV:
                CheckEvent(wallId);
                break;
            }
        }
        catch (Exception e)
        {
            Log.AddLine("Bad Wall Id -> " + name + " at: " + Time + "Error" + e.StackTrace);
        }
        SetColor();
    }
Beispiel #7
0
 private void CheckPose(WallsUtils.Walltype type, string id)
 {
     if (WallsUtils.CheckWallId(type, id))
     {
         _mainColor      = ColorPose;
         _secundaryColor = PressedColorPose;
         SetTextToggle("P");
     }
     else
     {
         Log.AddLine("Bad pose -> " + id + " at: " + Time);
         SetTextToggle("P?");
     }
 }
Beispiel #8
0
    public void SelectWallTab(WallsUtils.Walltype wallType, string id = null)
    {
        _currentTab.SetActive(false);

        string currentType = _wallObjectId.GetComponentInChildren <InputField>().text;

        GameObject currentToggleGroup;

        switch (wallType)
        {
        case WallsUtils.Walltype.NONE:
            return;

        case WallsUtils.Walltype.WP:
            // _backgroundImage.GetComponent<Image>().color = new Color32(139, 212, 255, 255);
            _currentTab        = ObjectsLibrary.Find("ImageCheatSheet/ObjectSelected/Shape").gameObject;
            currentToggleGroup = ToggleGroupWallType.Find("Shape").gameObject;
            CurrentWall        = WallShape;
            CurrentWall.Id     = id == null ? CurrentWall.Id : id;

            UpdateUIWallObjectProperties(CurrentWall.Id);
            UpdateUIWallObjectSprite(CurrentWall.Id);
            enableChanges();
            MoveWallObjectSprite();
            UpdateUIToggles(_currentTab);
            break;

        case WallsUtils.Walltype.WA:
            // _backgroundImage.GetComponent<Image>().color = new Color32(22, 11, 111, 255);
            _currentTab        = ObjectsLibrary.Find("ImageCheatSheet/ObjectSelected/Dodge").gameObject;
            currentToggleGroup = ToggleGroupWallType.Find("Dodge").gameObject;
            // ChangeToggle(currentToggleGroup);

            CurrentWall    = WallDodge;
            CurrentWall.Id = id == null ? CurrentWall.Id : id;

            UpdateUIWallObjectProperties(CurrentWall.Id);
            UpdateDodgeSprite(CurrentWall.Id);
            UpdateUIToggles(_currentTab);

            break;

        case WallsUtils.Walltype.WH:
            // _backgroundImage.GetComponent<Image>().color = new Color32(191, 39, 45, 255);
            // _image.GetComponent<Image>().color = new Color32(191, 39, 45, 255);
            _currentTab        = ObjectsLibrary.Find("ImageCheatSheet/ObjectSelected/Hit").gameObject;
            currentToggleGroup = ToggleGroupWallType.Find("Hit").gameObject;
            // ChangeToggle(currentToggleGroup);
            CurrentWall    = WallHit;
            CurrentWall.Id = id == null ? CurrentWall.Id : id;

            UpdateUIWallObjectProperties(CurrentWall.Id);
            UpdateUIToggles(_currentTab);
            UpdateLibraryChangeHits(CurrentWall.Id);

            break;

        case WallsUtils.Walltype.WC:
            /*_currentTab = ObjectsLibrary.Find("ImageCheatSheet/ObjectSelected/Custom").gameObject;
             * currentToggleGroup = ToggleGroupWallType.Find("Custom").gameObject;
             * CurrentWall = WallCustom;
             * CurrentWall.Id = id == null ? CurrentWall.Id : id;
             *
             * UpdateUIWallObjectProperties(CurrentWall.Id);
             * UpdateUIToggles(_currentTab);
             * UpdateLibraryChangeHits(CurrentWall.Id);*/

            return;

        case WallsUtils.Walltype.CN:
            // _backgroundImage.GetComponent<Image>().color = new Color32(22, 33, 44, 255);
            _currentTab        = ObjectsLibrary.Find("ImageCheatSheet/ObjectSelected/Coin").gameObject;
            currentToggleGroup = ToggleGroupWallType.Find("Coin").gameObject;
            // ChangeToggle(currentToggleGroup);
            CurrentWall    = WallCoin;
            CurrentWall.Id = id == null ? CurrentWall.Id : id;


            UpdateUIWallObjectProperties(CurrentWall.Id);
            UpdateCoin(WallCoin.X, WallCoin.Y);
            break;

        case WallsUtils.Walltype.EV:
            return;

        default:
            return;
        }
        ChangeToggle(currentToggleGroup);



        _currentTab.SetActive(true);
    }