Example #1
0
    public static bool TestDepenency(EZScreenPlacement sp)
    {
        if (sp.relativeObject == null)
        {
            return(true);
        }
        List <EZScreenPlacement> list = new List <EZScreenPlacement>();

        list.Add(sp);
        EZScreenPlacement eZScreenPlacement = sp.relativeObject.GetComponent(typeof(EZScreenPlacement)) as EZScreenPlacement;

        while (eZScreenPlacement != null)
        {
            if (list.Contains(eZScreenPlacement))
            {
                return(false);
            }
            list.Add(eZScreenPlacement);
            if (eZScreenPlacement.relativeObject == null)
            {
                return(true);
            }
            eZScreenPlacement = (eZScreenPlacement.relativeObject.GetComponent(typeof(EZScreenPlacement)) as EZScreenPlacement);
        }
        return(true);
    }
Example #2
0
    public void Start()
    {
        if (m_started)
        {
            return;
        }
        m_started = true;

        if (renderCamera != null)
        {
            screenSize.x = renderCamera.pixelWidth;
            screenSize.y = renderCamera.pixelHeight;
        }

#if UNITY_EDITOR
        if (relativeObject != null)
        {
            EZScreenPlacement c = relativeObject.GetComponent <EZScreenPlacement>();
            if (c != null)
            {
                c.AddDependent(this);
            }
        }

        justEnabled = false;
#endif

        PositionOnScreenRecursively();
    }
Example #3
0
    // Use this for initialization
    void Awake()
    {
        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_PLAY_DIALOGUE, PlayDialogue);

        EZScreenPlacement ScreenPlacement = gameObject.transform.root.gameObject.GetComponent <EZScreenPlacement>();

        if (ScreenPlacement != null)
        {
            ScreenPlacement.SetCamera(UISystem.Instance.UiCamrea);
        }

        gameObject.transform.root.gameObject.SetActiveRecursively(false);

        InitialAllDialogue();

        BoxCollider box = mask.GetComponent <BoxCollider>();

        if (box != null)
        {
            box.size   = new UnityEngine.Vector3(1280, 720, 0);
            box.center = new UnityEngine.Vector3(0, 360, 0);
        }
        head.autoResize   = false;
        head.pixelPerfect = false;
        bgDownOther.transform.localPosition = new Vector3(-0.5f, 0, 1);
        bgUpOther.transform.localPosition   = new Vector3(-0.5f, 721, 1);
        bgDownMe.transform.localPosition    = new Vector3(-0.5f, 0, 1);
        bgUpMe.transform.localPosition      = new Vector3(-0.5f, 721, 1);
    }
    void Awake()
    {
        button1 = NameButton.GetComponent <SpriteText>();
        button2 = LevelButton.GetComponent <SpriteText>();
        button3 = WuXingButton.GetComponent <ActionButton>();
        button4 = AmbitButton.GetComponent <ActionButton>();
        button5 = HPButton.GetComponent <UIProgressBar>();
        button6 = MPButton.GetComponent <UIProgressBar>();

        //gameObject.SetActiveRecursively(false);

        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_MAINTARGET_CHANGED, TargetFrame_Update);
        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_UNIT_MP, TargetFrame_Update);
        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_UNIT_HP, TargetFrame_Update);
        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_UNIT_LEVEL, TargetFrame_Update);

        // Init Camera [4/1/2012 Ivan]
        EZScreenPlacement ScreenPlacement = gameObject.GetComponent <EZScreenPlacement>();

        if (ScreenPlacement != null)
        {
            ScreenPlacement.SetCamera(UISystem.Instance.UiCamrea);
        }
        updateTargetTip();
    }
Example #5
0
    public virtual bool DidChange(EZScreenPlacement sp)
    {
        if (worldPos != sp.transform.position)
        {
            if (sp.allowTransformDrag)
            {
                // Calculate new screen position:
                sp.WorldToScreenPos(sp.transform.position);
            }
            else
            {
                sp.PositionOnScreen();
            }
            return(true);
        }
        if (screenPos != sp.screenPos)
        {
            return(true);
        }
        if (renderCamera != null && (screenSize.x != sp.renderCamera.pixelWidth || screenSize.y != sp.renderCamera.pixelHeight))
        {
            return(true);
        }
        if (!relativeTo.Equals(sp.relativeTo))
        {
            return(true);
        }
        if (renderCamera != sp.renderCamera)
        {
            return(true);
        }
        if (relativeObject != sp.relativeObject)
        {
#if UNITY_EDITOR
            // Remove ourselves as a dependent on the previous object:
            if (relativeObject != null)
            {
                EZScreenPlacement c = relativeObject.GetComponent <EZScreenPlacement>();
                if (c != null)
                {
                    c.RemoveDependent(sp);
                }
            }

            // Add ourselves as a dependent to the new object:
            if (sp.relativeObject != null)
            {
                EZScreenPlacement c = sp.relativeObject.GetComponent <EZScreenPlacement>();
                if (c != null)
                {
                    c.AddDependent(sp);
                }
            }
#endif
            return(true);
        }

        return(false);
    }
Example #6
0
 public virtual void Mirror(EZScreenPlacement sp)
 {
     worldPos  = sp.transform.position;
     screenPos = sp.screenPos;
     relativeTo.Copy(sp.relativeTo);
     relativeObject = sp.relativeObject;
     renderCamera   = sp.renderCamera;
 }
Example #7
0
    // Notify the object that it has one fewer dependent.
    public void RemoveDependent(EZScreenPlacement sp)
    {
        List <EZScreenPlacement> temp = new List <EZScreenPlacement>();

        temp.AddRange(dependents);
        temp.Remove(sp);
        dependents = temp.ToArray();
    }
Example #8
0
 public virtual bool DidChange(EZScreenPlacement sp)
 {
     if (this.worldPos != sp.transform.position)
     {
         sp.WorldToScreenPos(sp.transform.position);
         return(true);
     }
     return(this.screenPos != sp.screenPos || !this.relativeTo.Equals(sp.relativeTo) || this.renderCamera != sp.renderCamera || this.relativeObject != sp.relativeObject);
 }
Example #9
0
 public virtual void Mirror(EZScreenPlacement sp)
 {
     worldPos  = sp.transform.position;
     screenPos = sp.screenPos;
     relativeTo.Copy(sp.relativeTo);
     relativeObject = sp.relativeObject;
     renderCamera   = sp.renderCamera;
     screenSize     = new Vector2(sp.renderCamera.pixelWidth, sp.renderCamera.pixelHeight);
 }
    void Start()
    {
        EZScreenPlacement ScreenPlacement = gameObject.GetComponent <EZScreenPlacement>();

        if (ScreenPlacement != null)
        {
            ScreenPlacement.SetCamera(UISystem.Instance.UiCamrea);
        }
    }
    void Show()
    {
        gameObject.transform.parent.gameObject.SetActiveRecursively(true);
        EZScreenPlacement ScreenPlacement = gameObject.transform.parent.gameObject.GetComponent <EZScreenPlacement>();

        if (ScreenPlacement != null)
        {
            ScreenPlacement.SetCamera(UISystem.Instance.UiCamrea);
        }
    }
Example #12
0
    public void FirstEnter(GAME_EVENT_ID gAME_EVENT_ID, List <string> vParam)
    {
        gameObject.transform.localPosition = oldPos;
        EZScreenPlacement ScreenPlacement = gameObject.GetComponent <EZScreenPlacement>();

        if (ScreenPlacement != null)
        {
            ScreenPlacement.SetCamera(UISystem.Instance.UiCamrea);
        }
    }
Example #13
0
 public void OnDestroy()
 {
     if (relativeObject != null)
     {
         EZScreenPlacement c = relativeObject.GetComponent <EZScreenPlacement>();
         if (c != null)
         {
             c.RemoveDependent(this);
         }
     }
 }
Example #14
0
    // Notify this object that it has a dependent object.
    public void AddDependent(EZScreenPlacement sp)
    {
        List <EZScreenPlacement> temp = new List <EZScreenPlacement>();

        temp.AddRange(dependents);

        if (!temp.Contains(sp))
        {
            temp.Add(sp);
            dependents = temp.ToArray();
        }
    }
Example #15
0
    void Awake()
    {
        //Hide();

        EZScreenPlacement ScreenPlacement = gameObject.transform.root.gameObject.GetComponent <EZScreenPlacement>();

        if (ScreenPlacement != null)
        {
            ScreenPlacement.SetCamera(UISystem.Instance.UiCamrea);
        }

        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_RELIVE_SHOW, ToggleRelive);
        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_RELIVE_HIDE, ToggleRelive);
    }
Example #16
0
 public void PositionOnScreenRecursively()
 {
     if (!this.m_started)
     {
         this.Start();
     }
     if (this.relativeObject != null)
     {
         EZScreenPlacement eZScreenPlacement = this.relativeObject.GetComponent(typeof(EZScreenPlacement)) as EZScreenPlacement;
         if (eZScreenPlacement != null)
         {
             eZScreenPlacement.PositionOnScreenRecursively();
         }
     }
     this.PositionOnScreen();
 }
Example #17
0
    void Start()
    {
        EZScreenPlacement ScreenPlacement = gameObject.GetComponent <EZScreenPlacement>();

        if (ScreenPlacement != null)
        {
            ScreenPlacement.SetCamera(UISystem.Instance.UiCamrea);
        }

        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_NEW_ITEM, OnEvent);
        //CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_PACKAGE_ITEM_CHANGED, OnEvent);
        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_UNIT_HP, OnEvent);

        actionButton.AddInputDelegate(OnActionButtonClicked);

        gameObject.SetActiveRecursively(false);
    }
Example #18
0
    /// <summary>
    /// Positions the object, taking into account any object-relative
    /// dependencies, making sure the objects to which this object is
    /// relative are correctly positioned before positioning this one.
    /// </summary>
    public void PositionOnScreenRecursively()
    {
        if (!m_awake)
        {
            Awake();
        }

        if (relativeObject != null)
        {
            EZScreenPlacement sp = relativeObject.GetComponent <EZScreenPlacement>();
            if (sp != null)
            {
                sp.PositionOnScreenRecursively();
            }
        }

        PositionOnScreen();
    }
Example #19
0
    protected void Init()
    {
        screenPlacer = (EZScreenPlacement)m_ControlObject.GetComponent(typeof(EZScreenPlacement));

        if (m_spriteMesh != null)
        {
            if (m_spriteMesh.texture != null)
            {
                SetPixelToUV(m_spriteMesh.texture);
            }
            m_spriteMesh.Init();
        }

        if (!Application.isPlaying)
        {
            CalcSizeUnitsPerUV();
        }
    }
Example #20
0
    /// <summary>
    /// Positions the object, taking into account any object-relative
    /// dependencies, making sure the objects to which this object is
    /// relative are correctly positioned before positioning this one.
    /// </summary>
    public void PositionOnScreenRecursively()
    {
        if (!m_started)
        {
            Start();
        }

        if (relativeObject != null)
        {
            EZScreenPlacement sp = relativeObject.GetComponent(typeof(EZScreenPlacement)) as EZScreenPlacement;
            if (sp != null)
            {
                sp.PositionOnScreenRecursively();
            }
        }

        PositionOnScreen();
    }
Example #21
0
    private void InitUi()
    {
        mapControl.InitialControls();
        mapControl.EnableAll();
        mapControl.AlwaysInCenter = false;

        EZScreenPlacement ScreenPlacement = gameObject.transform.root.gameObject.GetComponent <EZScreenPlacement>();

        if (ScreenPlacement != null)
        {
            ScreenPlacement.SetCamera(UISystem.Instance.UiCamrea);
        }

        //gameObject.transform.root.gameObject.SetActiveRecursively(false);


        inputX.SetValidationDelegate(MyValidator);
        inputY.SetValidationDelegate(MyValidator);
    }
Example #22
0
 public virtual bool Validate(EZScreenPlacement sp)
 {
     if (sp.relativeTo.horizontal != EZScreenPlacement.HORIZONTAL_ALIGN.OBJECT && sp.relativeTo.vertical != EZScreenPlacement.VERTICAL_ALIGN.OBJECT)
     {
         sp.relativeObject = null;
     }
     if (sp.relativeObject != null && !EZScreenPlacement.TestDepenency(sp))
     {
         TsLog.LogError(string.Concat(new string[]
         {
             "ERROR: The Relative Object you recently assigned on \"",
             sp.name,
             "\" which points to \"",
             sp.relativeObject.name,
             "\" would create a circular dependency.  Please check your placement dependencies to resolve this."
         }), new object[0]);
         sp.relativeObject = null;
     }
     return(true);
 }
Example #23
0
    // Notify this object that it has a dependent object.
    public void AddDependent(EZScreenPlacement sp)
    {
        // Ensure the object isn't already on our list:
        foreach (EZScreenPlacement d in dependents)
        {
            if (d == sp)
            {
                return;
            }
        }

        List <EZScreenPlacement> temp = new List <EZScreenPlacement>();

        temp.AddRange(dependents);

        if (!temp.Contains(sp))
        {
            temp.Add(sp);
            dependents = temp.ToArray();
        }
    }
Example #24
0
    public virtual bool Validate(EZScreenPlacement sp)
    {
        // Only allow assignment of a relative object IF
        // we intend to use it:
        if (sp.relativeTo.horizontal != EZScreenPlacement.HORIZONTAL_ALIGN.OBJECT &&
            sp.relativeTo.vertical != EZScreenPlacement.VERTICAL_ALIGN.OBJECT)
        {
            sp.relativeObject = null;
        }

        // See if our dependency is circular:
        if (sp.relativeObject != null)
        {
            if (!EZScreenPlacement.TestDepenency(sp))
            {
                Debug.LogError("ERROR: The Relative Object you recently assigned on \"" + sp.name + "\" which points to \"" + sp.relativeObject.name + "\" would create a circular dependency.  Please check your placement dependencies to resolve this.");
                sp.relativeObject = null;
            }
        }

        return(true);
    }
Example #25
0
    public virtual bool DidChange(EZScreenPlacement sp)
    {
        if (screenPos != sp.screenPos)
        {
            return(true);
        }
        if (!relativeTo.Equals(sp.relativeTo))
        {
            return(true);
        }
        if (relativeObject != sp.relativeObject)
        {
#if UNITY_EDITOR
            // Remove ourselves as a dependent on the previous object:
            if (relativeObject != null)
            {
                EZScreenPlacement c = relativeObject.GetComponent <EZScreenPlacement>();
                if (c != null)
                {
                    c.RemoveDependent(sp);
                }
            }

            // Add ourselves as a dependent to the new object:
            if (sp.relativeObject != null)
            {
                EZScreenPlacement c = sp.relativeObject.GetComponent <EZScreenPlacement>();
                if (c != null)
                {
                    c.AddDependent(sp);
                }
            }
#endif
            return(true);
        }

        return(false);
    }
Example #26
0
    void InitGo()
    {
        EZScreenPlacement ScreenPlacement = gameObject.transform.root.gameObject.GetComponent <EZScreenPlacement>();

        if (ScreenPlacement != null)
        {
            //ScreenPlacement.SetCamera(UISystem.Instance.UiCamrea);
            ScreenPlacement.RenderCamera = UISystem.Instance.UiCamrea;
        }

        PackedSprite sprite1 = cartoonBtn1.GetComponent <PackedSprite>();
        PackedSprite sprite2 = cartoonBtn2.GetComponent <PackedSprite>();

        if (sprite1 != null)
        {
            //sprite1.SetCamera(UISystem.Instance.UiCamrea);
            sprite1.RenderCamera = UISystem.Instance.UiCamrea;
        }

        if (sprite2 != null)
        {
            sprite2.RenderCamera = UISystem.Instance.UiCamrea;
        }
    }
Example #27
0
    // Tests dependencies for circular dependency.
    // Returns true if safe, false if circular.
    static public bool TestDepenency(EZScreenPlacement sp)
    {
        if (sp.relativeObject == null)
        {
            return(true);
        }

        // Table of all objects in the chain of dependency:
        List <EZScreenPlacement> objs = new List <EZScreenPlacement>();

        objs.Add(sp);

        EZScreenPlacement curObj = sp.relativeObject.GetComponent(typeof(EZScreenPlacement)) as EZScreenPlacement;

        // Walk the chain:
        while (curObj != null)
        {
            if (objs.Contains(curObj))
            {
                return(false);                // Circular!
            }
            // Add this one to the list and keep walkin'
            objs.Add(curObj);

            // See if we're at the end of the chain:
            if (curObj.relativeObject == null)
            {
                return(true);
            }

            // Get the next one:
            curObj = curObj.relativeObject.GetComponent(typeof(EZScreenPlacement)) as EZScreenPlacement;
        }

        return(true);
    }
Example #28
0
 protected virtual void Init()
 {
     this.screenPlacer = (EZScreenPlacement)base.GetComponent(typeof(EZScreenPlacement));
     if (!Application.isPlaying && this.screenPlacer != null)
     {
         this.screenPlacer.SetCamera(this.renderCamera);
     }
     if (this.m_spriteMesh != null)
     {
         if (this.persistent && !this.managed)
         {
             UnityEngine.Object.DontDestroyOnLoad(((SpriteMesh)this.m_spriteMesh).mesh);
         }
         if (this.m_spriteMesh.texture != null)
         {
             this.SetPixelToUV(this.m_spriteMesh.texture);
         }
         this.m_spriteMesh.Init();
     }
     if (!Application.isPlaying)
     {
         this.CalcSizeUnitsPerUV();
     }
 }
Example #29
0
	protected virtual void Init()
	{
		// Get our screen placer, if any:
		screenPlacer = (EZScreenPlacement)GetComponent(typeof(EZScreenPlacement));

		if (!Application.isPlaying)
		{
			if (screenPlacer != null)
				screenPlacer.SetCamera(renderCamera);
		}

		// Get a default font:
		if(font == null && UIManager.Exists())
			font = UIManager.instance.defaultFont;

		if (meshRenderer.sharedMaterial == null && UIManager.Exists())
		{
			meshRenderer.sharedMaterial = UIManager.instance.defaultFontMaterial;
			if (meshRenderer.sharedMaterial != null)
				texture = meshRenderer.sharedMaterial.mainTexture;
		}
		else
		{
			if (meshRenderer.sharedMaterial != null)
				texture = meshRenderer.sharedMaterial.mainTexture;
		}

#if WARN_ON_NO_MATERIAL
		if (texture == null && Application.isPlaying)
			Debug.LogWarning("Text on GameObject \"" + name + "\" has not been assigned either a texture or a material.");
#endif


		// Get the font:
		if (font != null)
		{
			spriteFont = FontStore.GetFont(font);

			if (spriteFont == null)
				Debug.LogWarning("Warning: " + name + " was unable to load font \"" + font.name + "\"!");
		}
		else if(Application.isPlaying)
			Debug.LogWarning("Warning: " + name + " currently has no font assigned.");

		if (mesh == null)
		{
			CreateMesh();
		}

		// If this mesh is to persist, prevent it from being
		// destroyed on load:
		if (persistent)
		{
			Persistent = true;
		}

		if (texture != null)
			SetPixelToUV(texture);

		// Build our tab expansion string:
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < tabSize; ++i)
		{
			sb.Append(' ');
		}
		tabSpaces = sb.ToString();
	}
Example #30
0
    public virtual bool Validate(EZScreenPlacement sp)
    {
        // Only allow assignment of a relative object IF
        // we intend to use it:
        if (sp.relativeTo.horizontal != EZScreenPlacement.HORIZONTAL_ALIGN.OBJECT &&
            sp.relativeTo.vertical != EZScreenPlacement.VERTICAL_ALIGN.OBJECT)
            sp.relativeObject = null;

        // See if our dependency is circular:
        if (sp.relativeObject != null)
        {
            if(!EZScreenPlacement.TestDepenency(sp))
            {
                Debug.LogError("ERROR: The Relative Object you recently assigned on \"" + sp.name + "\" which points to \"" + sp.relativeObject.name + "\" would create a circular dependency.  Please check your placement dependencies to resolve this.");
                sp.relativeObject = null;
            }
        }

        return true;
    }
Example #31
0
 public virtual void Mirror(EZScreenPlacement sp)
 {
     screenPos = sp.screenPos;
     relativeTo.Copy(sp.relativeTo);
     relativeObject = sp.relativeObject;
 }
Example #32
0
    public virtual bool DidChange(EZScreenPlacement sp)
    {
        if (screenPos != sp.screenPos)
            return true;
        if (!relativeTo.Equals(sp.relativeTo))
            return true;
        if (relativeObject != sp.relativeObject)
        {
        #if UNITY_EDITOR
            // Remove ourselves as a dependent on the previous object:
            if(relativeObject != null)
            {
                EZScreenPlacement c = relativeObject.GetComponent<EZScreenPlacement>();
                if (c != null)
                    c.RemoveDependent(sp);
            }

            // Add ourselves as a dependent to the new object:
            if(sp.relativeObject != null)
            {
                EZScreenPlacement c = sp.relativeObject.GetComponent<EZScreenPlacement>();
                if (c != null)
                    c.AddDependent(sp);
            }
        #endif
            return true;
        }

        return false;
    }
Example #33
0
 // Notify the object that it has one fewer dependent.
 public void RemoveDependent(EZScreenPlacement sp)
 {
     List<EZScreenPlacement> temp = new List<EZScreenPlacement>();
     temp.AddRange(dependents);
     temp.Remove(sp);
     dependents = temp.ToArray();
 }
Example #34
0
    // Notify this object that it has a dependent object.
    public void AddDependent(EZScreenPlacement sp)
    {
        List<EZScreenPlacement> temp = new List<EZScreenPlacement>();
        temp.AddRange(dependents);

        if(!temp.Contains(sp))
        {
            temp.Add(sp);
            dependents = temp.ToArray();
        }
    }
Example #35
0
    // Tests dependencies for circular dependency.
    // Returns true if safe, false if circular.
    public static bool TestDepenency(EZScreenPlacement sp)
    {
        if (sp.relativeObject == null)
            return true;

        // Table of all objects in the chain of dependency:
        List<EZScreenPlacement> objs = new List<EZScreenPlacement>();

        objs.Add(sp);

        EZScreenPlacement curObj = sp.relativeObject.GetComponent<EZScreenPlacement>();

        // Walk the chain:
        while(curObj != null)
        {
            if (objs.Contains(curObj))
                return false; // Circular!

            // Add this one to the list and keep walkin'
            objs.Add(curObj);

            // See if we're at the end of the chain:
            if (curObj.relativeObject == null)
                return true;

            // Get the next one:
            curObj = curObj.relativeObject.GetComponent<EZScreenPlacement>();
        }

        return true;
    }
Example #36
0
	//name same as spriteroot class so it will be called from broadcast message
	public void ResizeAndReposition (SpriteRoot spriteCalledFrom)
	{
		Transform originalParent = transform.parent;
		
		switch (repositionOptions)
		{
			case ResizeRepositionOptions.byScreenPercentage:
			
				if (screenPlacer == null)
					screenPlacer = gameObject.AddComponent(typeof(EZScreenPlacement)) as EZScreenPlacement;
				
				screenPlacer.relativeTo.horizontal = EZScreenPlacement.HORIZONTAL_ALIGN.SCREEN_LEFT;
				screenPlacer.relativeTo.vertical = EZScreenPlacement.VERTICAL_ALIGN.SCREEN_TOP;
				
				//need to reverse the y so it goes the right way
				screenPlacer.screenPos = new Vector3 (renderCamera.pixelWidth * (repositionPercentage.x / 100), renderCamera.pixelHeight * (-repositionPercentage.y / 100), screenPlacer.screenPos.z);
				screenPlacer.PositionOnScreen ();
				
				break;
				
			case ResizeRepositionOptions.bySpritePercentage:
				
				if (parentSprite != null)
				{
					if (screenPlacer != null)
						DestroyImmediate (screenPlacer);
					
					transform.parent = parentSprite.transform;
					
					Vector2 temp = EZGUIExtensions.GetPositionFromParentSprite (parentSprite, repositionPercentage);
					transform.localPosition = new Vector3 (temp.x, temp.y, -0.1f); // always be in front of sprite
					
				}
				else
					ScreenLog.AddMessage ("Warning! " + gameObject + this.GetType ().ToString () + " Component parentSprite variable is null!", ScreenLogType.Warning);
				
				break;
		}
		
		if (keepOriginalParent == true)
			transform.parent = originalParent;
	}
Example #37
0
 public RelativeTo(EZScreenPlacement sp)
 {
     script = sp;
 }
Example #38
0
	protected virtual void Init()
	{
		// Get our screen placer, if any:
		screenPlacer = (EZScreenPlacement)GetComponent(typeof(EZScreenPlacement));

		if (!Application.isPlaying)
		{
			if (screenPlacer != null)
				screenPlacer.SetCamera(renderCamera);
		}

		if(font == null)
		{
			// Get a default font:
			if(UIManager.Exists())
				font = UIManager.instance.defaultFont;
		}

		// Get the font:
		if (font != null)
		{
			spriteFont = FontStore.GetFont(font);

			if (spriteFont == null)
				Debug.LogWarning("Warning: " + name + " was unable to load font \"" + font.name + "\"!");
		}
		else if(Application.isPlaying)
			Debug.LogWarning("Warning: " + name + " currently has no font assigned.");

		if (mesh == null)
		{
			meshFilter.sharedMesh = new Mesh();
			mesh = meshFilter.sharedMesh;
		}

		// If this mesh is to persist, prevent it from being
		// destroyed on load:
		if (persistent)
		{
			Persistent = true;
		}

		if (texture != null)
			SetPixelToUV(texture);

		// Build our tab expansion string:
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < tabSize; ++i)
		{
			sb.Append(' ');
		}
		tabSpaces = sb.ToString();

		ProcessString(text);
	}
Example #39
0
 // Copy constructor
 public RelativeTo(EZScreenPlacement sp, RelativeTo rt)
 {
     script = sp;
     Copy(rt);
 }