// Use this for initialization void Init() { // Debug.Log("apply"); us=gameObject.GetComponent<RectTransform>(); //from=us.parent as RectTransform; us.SetParent(us.RootCanvasTransform()); us.SetInternalAnchors (new Vector4 (0, 0, 1, 1)); //start=us.rect; //reference=from.rect; Rect rr = to.RootCanvasRect (); // Debug.Log(rr); tovec = (us.parent as RectTransform).getAnchorsFromCanvasRect (rr); // Debug.Log(tovec); stvec = new Vector4 (us.anchorMin.x,us.anchorMin.y,us.anchorMax.x,us.anchorMax.y); }
void Init() { trans= gameObject.GetComponent<RectTransform>(); if(trans==null) { Destroy(this);return; } canv=trans.RootCanvasTransform(); //canvrect=canv.rect; taillen=height*tail.width/tail.height; headlen=height*head.width/head.height; bodylen=height*body.width/body.height; }
// CardFlip flip; // Use this for initialization //public SingleGame.Conditional cardData; public override void Start() { rtransform=gameObject.GetComponent<RectTransform>(); canv=rtransform.RootCanvasTransform(); text.text=cardData[SingleGame._cardText] as string; string imgname=cardData["_cardImage"] as string; if(imgname !=null) { Texture2D txt=Resources.Load(imgname) as Texture2D; if(txt!=null) cardImg.texture=txt; } game=cardData[SingleGame._rootl] as SingleGame.Conditional; player1=game["Player1"] as SingleGame.Conditional; }