예제 #1
0
 void Start()
 {
     if (canvas != null && !vars.ContainsKey(canvas))
     {
         vars[canvas] = new WrappedRect(canvas);
     }
     if (Screen.width != prevScreen.x)
     {
         Rebuild();
         //   updateScreenConstraints();
     }
     instance = this;
 }
예제 #2
0
 public void ToggleByIndex(int index)
 {
     if (solver == null)
     {
         solver = FindObjectOfType <SimplexCalc>();
     }
     if (solver == null)
     {
         return;
     }
     if (index < 0 || index >= toggles.Length)
     {
         Debug.LogFormat("Invalid toggle index {0}", index);
         return;
     }
     //cassowary.Constraint oldC = toggles[current].getConstraint(solver.getVarsDict());
     // cassowary.Constraint newC = toggles[index].getConstraint(solver.getVarsDict());
     //solver.removeConstraint(oldC);
     //solver.addConstraint(newC);
     solver.triggerRebuild();
     current = index;
 }
예제 #3
0
    public void OnEnabled()
    {
        simplex    = FindObjectOfType <SimplexCalc>();
        landscaped = gameObject.GetComponentsInChildren <Landscaped>(true);
        mine       = gameObject.GetComponent <RectTransform>();
        if (mine != null)
        {
            Vector2 wh = mine.offsetMax - mine.offsetMin;
            if (wh.x > wh.y)
            {
                _isPortrait = false;
            }
            else
            {
                _isPortrait = true;
            }

            foreach (Landscaped l in landscaped)
            {
                l.Switch(_isPortrait);
            }
        }
    }
예제 #4
0
    void OnRectTransformDimensionsChange()
    {
        if (simplex == null)
        {
            simplex = FindObjectOfType <SimplexCalc>();
        }
        //  Debug.LogFormat("Simplex {0}",simplex);
        if (simplex != null)
        {
            simplex.triggerRebuild();
        }
        landscaped = gameObject.GetComponentsInChildren <Landscaped>(true);
        if (mine == null)
        {
            mine = gameObject.GetComponent <RectTransform>();
        }
        // Debug.LogFormat("Tmrw: scale {0}", me.scaleFactor);
        // Debug.LogFormat("Changed {0} {1}",mine.offsetMin,mine.offsetMax);
        Vector2 wh = mine.offsetMax - mine.offsetMin;

        beSwitched(wh);
        beenFlipped = false;
    }
예제 #5
0
 // Start is called before the first frame update
 void Start()
 {
     solver = FindObjectOfType <SimplexCalc>();
 }