예제 #1
0
 void ApplySafeArea(Rect r)
 {
     // Convert safe area rectangle from absolute pixels to normalised anchor coordinates
     Panel.anchorMin = r.position;
     Panel.anchorMax = r.position + r.size;
     Debug.Log(Panel);
     Debug.LogFormat("New safe area applied to {0}: x={1}, y={2}, w={3}, h={4} on full extents w={5}, h={6}",
                     name, r.x, r.y, r.width, r.height, Screen.width, Screen.height);
     simplink?.triggerRebuild();
 }
예제 #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
    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;
    }