Пример #1
0
 public Panel(Panel panel)
 {
     type = panel.type;
     size = panel.size;
     height = panel.height;
     heightOffset = panel.heightOffset;
 }
Пример #2
0
 public Panel(Panel panel)
 {
     type         = panel.type;
     size         = panel.size;
     height       = panel.height;
     heightOffset = panel.heightOffset;
 }
Пример #3
0
        public void SetPanelSize(PanelSize panelSize)
        {
            // HACK: とりあえず決めうちにした
            int[] formHeight = { 558, 750, 940 };
            switch (panelSize)
            {
            case PanelSize.Small:
                ScoreInfo.ScaleConstant = .25f;
                tsmiSizeSmall.Checked   = true;
                tsmiSizeMiddle.Checked  = false;
                tsmiSizeBig.Checked     = false;
                Height = formHeight[0];
                break;

            case PanelSize.Middle:
                ScoreInfo.ScaleConstant = .375f;
                tsmiSizeSmall.Checked   = false;
                tsmiSizeMiddle.Checked  = true;
                tsmiSizeBig.Checked     = false;
                Height = formHeight[1];
                break;

            case PanelSize.Big:
                ScoreInfo.ScaleConstant = .5f;
                tsmiSizeSmall.Checked   = false;
                tsmiSizeMiddle.Checked  = false;
                tsmiSizeBig.Checked     = true;
                Height = formHeight[2];
                break;
            }
            ScoreInfo.LaneMaxBar = ScoreInfo.ScaleConstant / ScoreInfo.UnitBeatHeight;
            ScoreLane.RefreshLaneSize();
            foreach (TabPageEx tabPageEx in tabScore.TabPages)
            {
                tabPageEx.ScorePanel.RefreshLaneSize();
            }
        }
Пример #4
0
    private void CreateRandomBreakables(PanelConfiguration panelConfig, PanelSize size, GameObject parentPanel)
    {
        GameObject prefab = null;
        Bounds     bounds = parentPanel.GetComponentInChildren <Renderer>().bounds;

        switch (size)
        {
        case PanelSize.LARGE:
        {
            int spaces = 4;
            while (spaces > 0)
            {
                int random = _currentLevel == 1 ? 8 : UnityEngine.Random.Range(0, 10);
                if (random <= 8 && spaces == 4)
                {
                    prefab = _breakableContainer.GetRandomLargeBreakable();
                    InstantiatePanel(prefab, parentPanel.transform.parent.gameObject,
                                     parentPanel.transform.localPosition, parentPanel.transform.rotation);
                    spaces -= 4;
                }
                else if (random > 6 && random < 9 && spaces % 2 == 0)
                {
                    prefab = _breakableContainer.GetRandomMediumBreakable();
                    Vector3 offset = new Vector3(bounds.size.x / 4.0f, 0.0f, 0.0f);
                    offset = spaces == 4 ? offset * -1.0f : offset;
                    InstantiatePanel(prefab, parentPanel.transform.parent.gameObject,
                                     parentPanel.transform.localPosition - offset, parentPanel.transform.rotation);
                    spaces -= 2;
                }
                else
                {
                    prefab = _breakableContainer.GetRandomSmallBreakable();

                    float   yMultiplied = parentPanel.transform.rotation == Quaternion.identity ? 4.0f : 2.0f;
                    Vector3 offset      = new Vector3(bounds.size.x / 4.0f, bounds.size.y / yMultiplied, 0.0f);

                    offset.x = spaces > 2 ? offset.x * -1.0f : offset.x;
                    offset.y = spaces % 2 == 0 ? offset.y * -1.0f : offset.y;
                    GameObject smallPanel = InstantiatePanel(prefab, parentPanel.transform.parent.gameObject,
                                                             parentPanel.transform.localPosition - offset, parentPanel.transform.rotation);
                    smallPanel.name = spaces.ToString();
                    spaces         -= 1;
                }
            }
        }
        break;

        case PanelSize.MEDIUM:
        {
            int spaces = 2;
            while (spaces > 0)
            {
                int random = _currentLevel == 2 ? 8 : UnityEngine.Random.Range(0, 10);
                if (random >= 3 && spaces == 2)
                {
                    prefab = _breakableContainer.GetRandomMediumBreakable();
                    InstantiatePanel(prefab, parentPanel.transform.parent.gameObject,
                                     parentPanel.transform.localPosition, parentPanel.transform.rotation);
                    spaces -= 2;
                }
                else
                {
                    prefab = _breakableContainer.GetRandomSmallBreakable();

                    float   yMultiplied = parentPanel.transform.rotation == Quaternion.identity ? 4.0f : 2.0f;
                    Vector3 offset      = new Vector3(0.0f, bounds.size.y / yMultiplied, 0.0f);
                    offset.y = spaces % 2 == 0 ? offset.y * -1.0f : offset.y;

                    InstantiatePanel(prefab, parentPanel.transform.parent.gameObject,
                                     parentPanel.transform.localPosition + offset, parentPanel.transform.rotation);
                    spaces -= 1;
                }
            }
        }
        break;

        case PanelSize.SMALL:
        {
            prefab = _breakableContainer.GetRandomSmallBreakable();
            InstantiatePanel(prefab, parentPanel.transform.parent.gameObject,
                             parentPanel.transform.localPosition, parentPanel.transform.rotation);
        }
        break;

        case PanelSize.MEDIUM_LANDSCAPE: {
            prefab = _breakableContainer.GetRandomMediumLandscapeBreakable();
            InstantiatePanel(prefab, parentPanel.transform.parent.gameObject,
                             parentPanel.transform.localPosition, parentPanel.transform.rotation);
        }
        break;
        }

        Destroy(parentPanel);
    }