Ejemplo n.º 1
0
	public override void Copy(SpriteRoot s, ControlCopyFlags flags)
	{
		base.Copy(s, flags);

		if (!(s is UIBtnWWW))
			return;

		UIBtnWWW b = (UIBtnWWW)s;

		if ((flags & ControlCopyFlags.Settings) == ControlCopyFlags.Settings)
		{
			URL = b.URL;
		}
	}
Ejemplo n.º 2
0
	public override void Copy(SpriteRoot s, ControlCopyFlags flags)
	{
		base.Copy(s, flags);

		if (!(s is UIBtnLoadScene))
			return;

		UIBtnLoadScene b = (UIBtnLoadScene)s;

		if ((flags & ControlCopyFlags.Settings) == ControlCopyFlags.Settings)
		{
			scene = b.scene;
			loadingPanel = b.loadingPanel;
		}
	}
Ejemplo n.º 3
0
    public override void Copy(IControl c, ControlCopyFlags flags)
    {
        base.Copy(c, flags);

        if (!(c is UIButton3D))
        {
            return;
        }

        UIButton3D b = (UIButton3D)c;

        if ((flags & ControlCopyFlags.State) == ControlCopyFlags.State)
        {
            prevTransition = b.prevTransition;

            if (Application.isPlaying)
            {
                SetControlState(b.controlState);
            }
        }

        if ((flags & ControlCopyFlags.Invocation) == ControlCopyFlags.Invocation)
        {
            scriptWithMethodToInvoke = b.scriptWithMethodToInvoke;
            methodToInvoke           = b.methodToInvoke;
            whenToInvoke             = b.whenToInvoke;
            delay = b.delay;
        }

        if ((flags & ControlCopyFlags.Sound) == ControlCopyFlags.Sound)
        {
            soundOnOver  = b.soundOnOver;
            soundOnClick = b.soundOnClick;
        }

        if ((flags & ControlCopyFlags.Settings) == ControlCopyFlags.Settings)
        {
            repeat = b.repeat;
        }
    }
Ejemplo n.º 4
0
    public override void Copy(SpriteRoot s, ControlCopyFlags flags)
    {
        base.Copy(s, flags);

        if (!(s is UIButton))
        {
            return;
        }

        UIButton btn = (UIButton)s;

        if ((flags & ControlCopyFlags.State) == ControlCopyFlags.State)
        {
            prevTransition = btn.prevTransition;

            if (Application.isPlaying)
            {
                SetControlState(btn.controlState);
            }
        }

        if ((flags & ControlCopyFlags.Invocation) == ControlCopyFlags.Invocation)
        {
            scriptWithMethodToInvoke = btn.scriptWithMethodToInvoke;
            methodToInvoke           = btn.methodToInvoke;
            whenToInvoke             = btn.whenToInvoke;
            delay = btn.delay;
        }

        if ((flags & ControlCopyFlags.Sound) == ControlCopyFlags.Sound)
        {
            soundOnOver  = btn.soundOnOver;
            soundOnClick = btn.soundOnClick;
        }

        if ((flags & ControlCopyFlags.Settings) == ControlCopyFlags.Settings)
        {
            repeat = btn.repeat;
        }
    }
Ejemplo n.º 5
0
    public override void Copy(IControl c, ControlCopyFlags flags)
    {
        if (!(c is UIRadioBtn3D))
        {
            return;
        }

        base.Copy(c);

        UIRadioBtn3D b = (UIRadioBtn3D)c;

        if ((flags & ControlCopyFlags.Settings) == ControlCopyFlags.Settings)
        {
            group        = b.group;
            defaultValue = b.defaultValue;
        }

        if ((flags & ControlCopyFlags.State) == ControlCopyFlags.State)
        {
            prevTransition = b.prevTransition;

            if (Application.isPlaying)
            {
                Value = b.Value;
            }
        }

        if ((flags & ControlCopyFlags.Invocation) == ControlCopyFlags.Invocation)
        {
            scriptWithMethodToInvoke = b.scriptWithMethodToInvoke;
            methodToInvoke           = b.methodToInvoke;
            whenToInvoke             = b.whenToInvoke;
            delay = b.delay;
        }

        if ((flags & ControlCopyFlags.Sound) == ControlCopyFlags.Sound)
        {
            soundToPlay = b.soundToPlay;
        }
    }
Ejemplo n.º 6
0
    public override void Copy(SpriteRoot s, ControlCopyFlags flags)
    {
        base.Copy(s, flags);

        if (!(s is UIRadioBtn))
        {
            return;
        }

        UIRadioBtn b = (UIRadioBtn)s;

        if ((flags & ControlCopyFlags.State) == ControlCopyFlags.State)
        {
            state          = b.state;
            prevTransition = b.prevTransition;
            if (Application.isPlaying)
            {
                Value = b.Value;
            }
        }

        if ((flags & ControlCopyFlags.Settings) == ControlCopyFlags.Settings)
        {
            group        = b.group;
            defaultValue = b.defaultValue;
        }

        if ((flags & ControlCopyFlags.Invocation) == ControlCopyFlags.Invocation)
        {
            scriptWithMethodToInvoke = b.scriptWithMethodToInvoke;
            methodToInvoke           = b.methodToInvoke;
            whenToInvoke             = b.whenToInvoke;
            delay = b.delay;
        }

        if ((flags & ControlCopyFlags.Sound) == ControlCopyFlags.Sound)
        {
            soundToPlay = b.soundToPlay;
        }
    }
Ejemplo n.º 7
0
    public override void Copy(SpriteRoot s, ControlCopyFlags flags)
    {
        base.Copy(s, flags);

        if (!(s is UIStateToggleBtn))
        {
            return;
        }

        UIStateToggleBtn b = (UIStateToggleBtn)s;

        if ((flags & ControlCopyFlags.Settings) == ControlCopyFlags.Settings)
        {
            defaultState = b.defaultState;
        }

        if ((flags & ControlCopyFlags.State) == ControlCopyFlags.State)
        {
            prevTransition = b.prevTransition;

            if (Application.isPlaying)
            {
                SetToggleState(b.StateNum);
            }
        }

        if ((flags & ControlCopyFlags.Invocation) == ControlCopyFlags.Invocation)
        {
            scriptWithMethodToInvoke = b.scriptWithMethodToInvoke;
            methodToInvoke           = b.methodToInvoke;
            whenToInvoke             = b.whenToInvoke;
            delay = b.delay;
        }

        if ((flags & ControlCopyFlags.Sound) == ControlCopyFlags.Sound)
        {
            soundToPlay = b.soundToPlay;
        }
    }
Ejemplo n.º 8
0
    public override void Copy(SpriteRoot s, ControlCopyFlags flags)
    {
        base.Copy(s, flags);

        if (!(s is UIProgressBar))
        {
            return;
        }

        if (Application.isPlaying)
        {
            UIProgressBar b = (UIProgressBar)s;


            if ((flags & ControlCopyFlags.Appearance) == ControlCopyFlags.Appearance)
            {
                if (emptySprite != null)
                {
                    emptySprite.Copy(b.emptySprite);
                }
            }
        }
    }
Ejemplo n.º 9
0
    public override void Copy(SpriteRoot s, ControlCopyFlags flags)
    {
        base.Copy(s, flags);

        if (!(s is UITextField))
        {
            return;
        }

        UITextField b = (UITextField)s;


        if ((flags & ControlCopyFlags.Settings) == ControlCopyFlags.Settings)
        {
            maxLength = b.maxLength;

#if UNITY_IPHONE || UNITY_ANDROID
            type        = b.type;
            autoCorrect = b.autoCorrect;
            secure      = b.secure;
            alert       = b.alert;
#endif
            typingSoundEffect = b.typingSoundEffect;
            fieldFullSound    = b.fieldFullSound;
        }

        if ((flags & ControlCopyFlags.Appearance) == ControlCopyFlags.Appearance)
        {
            caret.Copy(b.caret);
        }

        if ((flags & ControlCopyFlags.State) == ControlCopyFlags.State)
        {
            insert = b.insert;
            Text   = b.Text;
        }
    }
Ejemplo n.º 10
0
    public override void Copy(SpriteRoot s, ControlCopyFlags flags)
    {
        base.Copy(s, flags);

        if (!(s is UIPanelTab))
        {
            return;
        }

        UIPanelTab b = (UIPanelTab)s;

        if ((flags & ControlCopyFlags.Settings) == ControlCopyFlags.Settings)
        {
            toggle              = b.toggle;
            panelManager        = b.panelManager;
            panel               = b.panel;
            panelShowingAtStart = b.panelShowingAtStart;
        }

        if ((flags & ControlCopyFlags.State) == ControlCopyFlags.State)
        {
            panelIsShowing = b.panelIsShowing;
        }
    }
Ejemplo n.º 11
0
	public virtual void Copy(IControl ctl, ControlCopyFlags flags)
	{
		if (!(ctl is ControlBase))
			return;

		ControlBase c = (ControlBase)ctl;


		// Copy transitions:
		if ((flags & ControlCopyFlags.Transitions) == ControlCopyFlags.Transitions)
		{
			if (c is UIStateToggleBtn3D)
			{
				if (c.Transitions != null)
				{
					((UIStateToggleBtn3D)this).transitions = new EZTransitionList[c.Transitions.Length];
					for (int i = 0; i < Transitions.Length; ++i)
						c.Transitions[i].CopyToNew(Transitions[i], true);
				}
			}
			else
			{
				if (Transitions != null && c.Transitions != null)
					for (int i = 0; i < Transitions.Length && i < c.Transitions.Length; ++i)
						c.Transitions[i].CopyTo(Transitions[i], true);
			}
		}


		if ((flags & ControlCopyFlags.Text) == ControlCopyFlags.Text)
		{
			// See if we want to clone the other
			// control's text mesh:
			if (spriteText == null && c.spriteText != null)
			{
				GameObject newText = (GameObject)Instantiate(c.spriteText.gameObject);
				newText.transform.parent = transform;
				newText.transform.localPosition = c.spriteText.transform.localPosition;
				newText.transform.localScale = c.spriteText.transform.localScale;
				newText.transform.localRotation = c.spriteText.transform.localRotation;
			}

			Text = c.Text;
		}

		if ((flags & ControlCopyFlags.Appearance) == ControlCopyFlags.Appearance)
		{
			// See if we can copy the other control's collider's settings:
			if (collider.GetType() == c.collider.GetType())
			{
				if (collider is BoxCollider)
				{
					BoxCollider bc1 = (BoxCollider)collider;
					BoxCollider bc2 = (BoxCollider)c.collider;
					bc1.center = bc2.center;
					bc1.size = bc2.size;
				}
				else if (collider is SphereCollider)
				{
					SphereCollider sc1 = (SphereCollider)collider;
					SphereCollider sc2 = (SphereCollider)c.collider;
					sc1.center = sc2.center;
					sc1.radius = sc2.radius;
				}
				else if (collider is CapsuleCollider)
				{
					CapsuleCollider cc1 = (CapsuleCollider)collider;
					CapsuleCollider cc2 = (CapsuleCollider)c.collider;
					cc1.center = cc2.center;
					cc1.radius = cc2.radius;
					cc1.height = cc2.height;
					cc1.direction = cc2.direction;
				}
				else if (collider is MeshCollider)
				{
					MeshCollider mc1 = (MeshCollider)collider;
					MeshCollider mc2 = (MeshCollider)c.collider;
					mc1.smoothSphereCollisions = mc2.smoothSphereCollisions;
					mc1.convex = mc2.convex;
					mc1.sharedMesh = mc2.sharedMesh;
				}

				collider.isTrigger = c.collider.isTrigger;
			}
		}

		if ((flags & ControlCopyFlags.Invocation) == ControlCopyFlags.Invocation)
		{
			changeDelegate = c.changeDelegate;
			inputDelegate = c.inputDelegate;
		}

		if ((flags & ControlCopyFlags.State) == ControlCopyFlags.State)
		{
			Container = c.Container;

			if (Application.isPlaying)
				controlIsEnabled = c.controlIsEnabled;
		}
	}
Ejemplo n.º 12
0
	public override void Copy(SpriteRoot s, ControlCopyFlags flags)
	{
		base.Copy(s, flags);

		if (!(s is UIListItem))
			return;

		UIListItem b = (UIListItem)s;


		if ((flags & ControlCopyFlags.Settings) == ControlCopyFlags.Settings)
		{
			list = b.list;
		}

		if ((flags & ControlCopyFlags.Appearance) == ControlCopyFlags.Appearance)
		{
			topLeftEdge = b.topLeftEdge;
			bottomRightEdge = b.bottomRightEdge;
			colliderTL = b.colliderTL;
			colliderBR = b.colliderBR;
			colliderCenter = b.colliderCenter;
			customCollider = b.customCollider;
		}
	}
	public void Copy(IControl c, ControlCopyFlags flags)
	{
		Copy(c, ControlCopyFlags.All);
	}
	public override void Copy(SpriteRoot s, ControlCopyFlags flags)
	{
		base.Copy(s, flags);

		if (!(s is UIPanelTab))
			return;

		UIPanelTab b = (UIPanelTab)s;

		if ((flags & ControlCopyFlags.Settings) == ControlCopyFlags.Settings)
		{
			toggle = b.toggle;
			panelManager = b.panelManager;
			panel = b.panel;
			panelShowingAtStart = b.panelShowingAtStart;
		}

		if ((flags & ControlCopyFlags.State) == ControlCopyFlags.State)
		{
			Value = b.Value;
		}
	}
	public override void Copy(SpriteRoot s, ControlCopyFlags flags)
	{
		base.Copy(s, flags);

		if (!(s is UITextField))
			return;

		UITextField b = (UITextField)s;


		if ((flags & ControlCopyFlags.Settings) == ControlCopyFlags.Settings)
		{
			maxLength = b.maxLength;
			multiline = b.multiline;
			password = b.password;
			maskingCharacter = b.maskingCharacter;
			customKeyboard = b.customKeyboard;
			customFocusEvent = b.customFocusEvent;
			margins = b.margins;

#if UNITY_IPHONE || UNITY_ANDROID
			type = b.type;
			autoCorrect = b.autoCorrect;
			alert = b.alert;
			hideInput = b.hideInput;
#endif
			typingSoundEffect = b.typingSoundEffect;
			fieldFullSound = b.fieldFullSound;
		}

		if ((flags & ControlCopyFlags.Invocation) == ControlCopyFlags.Invocation)
		{
			scriptWithMethodToInvoke = b.scriptWithMethodToInvoke;
			methodToInvoke = b.methodToInvoke;
		}

		if ((flags & ControlCopyFlags.Appearance) == ControlCopyFlags.Appearance)
		{
			caret.Copy(b.caret);

			caretSize = b.caretSize;
			caretOffset = b.caretOffset;
			caretAnchor = b.caretAnchor;
			showCaretOnMobile = b.showCaretOnMobile;
		}

		if ((flags & ControlCopyFlags.State) == ControlCopyFlags.State)
		{
			insert = b.insert;
			Text = b.Text;
		}

		SetMargins(margins);
	}
Ejemplo n.º 16
0
	public override void Copy(SpriteRoot s, ControlCopyFlags flags)
	{
		base.Copy(s, flags);

		if (!(s is UIBtnChangePanel))
			return;

		UIBtnChangePanel b = (UIBtnChangePanel)s;

		if ((flags & ControlCopyFlags.Settings) == ControlCopyFlags.Settings)
		{
			panelManager = b.panelManager;
			changeType = b.changeType;
			panel = b.panel;
		}
	}
Ejemplo n.º 17
0
	public override void Copy(IControl c, ControlCopyFlags flags)
	{
		if (!(c is UIRadioBtn3D))
			return;

		base.Copy(c);

		UIRadioBtn3D b = (UIRadioBtn3D)c;

		if ((flags & ControlCopyFlags.Settings) == ControlCopyFlags.Settings)
		{
			group = b.group;
			defaultValue = b.defaultValue;
		}

		if ((flags & ControlCopyFlags.State) == ControlCopyFlags.State)
		{
			prevTransition = b.prevTransition;

			if (Application.isPlaying)
				Value = b.Value;
		}

		if ((flags & ControlCopyFlags.Invocation) == ControlCopyFlags.Invocation)
		{
			scriptWithMethodToInvoke = b.scriptWithMethodToInvoke;
			methodToInvoke = b.methodToInvoke;
			whenToInvoke = b.whenToInvoke;
			delay = b.delay;
		}

		if ((flags & ControlCopyFlags.Sound) == ControlCopyFlags.Sound)
		{
			soundToPlay = b.soundToPlay;
		}
	}
Ejemplo n.º 18
0
	public void Copy(IControl c, ControlCopyFlags flags)
	{
		if (!(c is AutoSpriteControlBase))
			return;

		Copy((SpriteRoot)c, flags);
	}
Ejemplo n.º 19
0
	public override void Copy(SpriteRoot s, ControlCopyFlags flags)
	{
		base.Copy(s, flags);

		if (!(s is UIRadioBtn))
			return;

		UIRadioBtn b = (UIRadioBtn)s;

		if ((flags & ControlCopyFlags.State) == ControlCopyFlags.State)
		{
			state = b.state;
			prevTransition = b.prevTransition;
			if (Application.isPlaying)
				Value = b.Value;
		}

		if ((flags & ControlCopyFlags.Settings) == ControlCopyFlags.Settings)
		{
			group = b.group;
			defaultValue = b.defaultValue;
		}

		if ((flags & ControlCopyFlags.Invocation) == ControlCopyFlags.Invocation)
		{
			scriptWithMethodToInvoke = b.scriptWithMethodToInvoke;
			methodToInvoke = b.methodToInvoke;
			whenToInvoke = b.whenToInvoke;
			delay = b.delay;
		}

		if ((flags & ControlCopyFlags.Sound) == ControlCopyFlags.Sound)
		{
			soundToPlay = b.soundToPlay;
		}
	}
Ejemplo n.º 20
0
	public override void Copy(SpriteRoot s, ControlCopyFlags flags)
	{
		base.Copy(s, flags);

		if (!(s is UITextField))
			return;

		UITextField b = (UITextField)s;


		if ((flags & ControlCopyFlags.Settings) == ControlCopyFlags.Settings)
		{
			maxLength = b.maxLength;

#if UNITY_IPHONE || UNITY_ANDROID
			type = b.type;
			autoCorrect = b.autoCorrect;
			secure = b.secure;
			alert = b.alert;
#endif
			typingSoundEffect = b.typingSoundEffect;
			fieldFullSound = b.fieldFullSound;
		}

		if ((flags & ControlCopyFlags.Appearance) == ControlCopyFlags.Appearance)
		{
			caret.Copy(b.caret);
		}

		if ((flags & ControlCopyFlags.State) == ControlCopyFlags.State)
		{
			insert = b.insert;
			Text = b.Text;
		}
	}
Ejemplo n.º 21
0
	public override void Copy(SpriteRoot s, ControlCopyFlags flags)
	{
		base.Copy(s, flags);

		if (!(s is UIButton))
			return;

		UIButton btn = (UIButton)s;

		if ((flags & ControlCopyFlags.State) == ControlCopyFlags.State)
		{
			prevTransition = btn.prevTransition;

			if (Application.isPlaying)
				SetControlState(btn.controlState);
		}

		if ((flags & ControlCopyFlags.Invocation) == ControlCopyFlags.Invocation)
		{
			scriptWithMethodToInvoke = btn.scriptWithMethodToInvoke;
			methodToInvoke = btn.methodToInvoke;
			whenToInvoke = btn.whenToInvoke;
			delay = btn.delay;
		}

		if ((flags & ControlCopyFlags.Sound) == ControlCopyFlags.Sound)
		{
			soundOnOver = btn.soundOnOver;
			soundOnClick = btn.soundOnClick;
		}

		if ((flags & ControlCopyFlags.Settings) == ControlCopyFlags.Settings)
		{
			repeat = btn.repeat;
		}
	}
Ejemplo n.º 22
0
	public override void Copy(IControl c, ControlCopyFlags flags)
	{
		base.Copy(c, flags);

		if (!(c is UIButton3D))
			return;

		UIButton3D b = (UIButton3D)c;

		if ((flags & ControlCopyFlags.State) == ControlCopyFlags.State)
		{
			prevTransition = b.prevTransition;

			if (Application.isPlaying)
				SetControlState(b.controlState);
		}

		if ((flags & ControlCopyFlags.Invocation) == ControlCopyFlags.Invocation)
		{
			scriptWithMethodToInvoke = b.scriptWithMethodToInvoke;
			methodToInvoke = b.methodToInvoke;
			whenToInvoke = b.whenToInvoke;
			delay = b.delay;
		}

		if ((flags & ControlCopyFlags.Sound) == ControlCopyFlags.Sound)
		{
			soundOnOver = b.soundOnOver;
			soundOnClick = b.soundOnClick;
		}

		if ((flags & ControlCopyFlags.Settings) == ControlCopyFlags.Settings)
		{
			repeat = b.repeat;
		}
	}
Ejemplo n.º 23
0
	public override void Copy(SpriteRoot s, ControlCopyFlags flags)
	{
		base.Copy(s, flags);

		if (!(s is UIProgressBar))
			return;

		if (Application.isPlaying)
		{
			UIProgressBar b = (UIProgressBar)s;


			if ((flags & ControlCopyFlags.Appearance) == ControlCopyFlags.Appearance)
			{
				if (emptySprite != null)
					emptySprite.Copy(b.emptySprite);
			}
		}
	}
Ejemplo n.º 24
0
	public override void Copy(SpriteRoot s, ControlCopyFlags flags)
	{
		base.Copy(s, flags);

		if (!(s is UISlider))
			return;

		UISlider b = (UISlider)s;


		if ((flags & ControlCopyFlags.Invocation) == ControlCopyFlags.Invocation)
		{
			scriptWithMethodToInvoke = b.scriptWithMethodToInvoke;
			methodToInvoke = b.methodToInvoke;
		}

		if ((flags & ControlCopyFlags.Settings) == ControlCopyFlags.Settings)
		{
			defaultValue = b.defaultValue;
			stopKnobFromEdge = b.stopKnobFromEdge;
			knobOffset = b.knobOffset;
			knobSize = b.knobSize;
			knobColliderSizeFactor = b.knobColliderSizeFactor;
		}

		if ((flags & ControlCopyFlags.Appearance) == ControlCopyFlags.Appearance)
		{
			if (Application.isPlaying)
			{
				if (emptySprite != null)
					emptySprite.Copy(b.emptySprite);

				if (knob != null)
					knob.Copy(b.knob);

				truncFloor = b.truncFloor;
				truncRange = b.truncRange;
			}
		}

		if ((flags & ControlCopyFlags.State) == ControlCopyFlags.State)
		{
			CalcKnobStartPos();
			Value = b.Value;
		}
	}
Ejemplo n.º 25
0
	/// <summary>
	/// Copies all of the specified control's settings
	/// to this control, provided they are of the same
	/// type.  One exception is that layers are not
	/// copied as this would require a new allocation
	/// and could negatively impact performance at
	/// runtime.
	/// </summary>
	/// <param name="s">Reference to the control whose settings are to be copied to this control.</param>
	public virtual void Copy(SpriteRoot s, ControlCopyFlags flags)
	{
		if ((flags & ControlCopyFlags.Appearance) == ControlCopyFlags.Appearance)
		{
			if (Application.isPlaying && s.Started)
				base.Copy(s);
			else // If we're in-editor, copy the TextureAnims too
				base.CopyAll(s);

			if (!(s is AutoSpriteControlBase))
			{
				if (autoResize || pixelPerfect)
					CalcSize();
				else
					SetSize(s.width, s.height);

				SetBleedCompensation();

				return;
			}
		}



		AutoSpriteControlBase c = (AutoSpriteControlBase)s;

		// Copy transitions:
		if ((flags & ControlCopyFlags.Transitions) == ControlCopyFlags.Transitions)
		{
			if (c is UIStateToggleBtn || !Application.isPlaying)
			{
				if (c.Transitions != null)
				{
					Transitions = new EZTransitionList[c.Transitions.Length];
					for (int i = 0; i < Transitions.Length; ++i)
					{
						Transitions[i] = new EZTransitionList();
						c.Transitions[i].CopyToNew(Transitions[i], true);
					}
				}
			}
			else
			{
				if (Transitions != null && c.Transitions != null)
					for (int i = 0; i < Transitions.Length && i < c.Transitions.Length; ++i)
						c.Transitions[i].CopyTo(Transitions[i], true);
			}
		}


		if ((flags & ControlCopyFlags.Text) == ControlCopyFlags.Text)
		{
			// See if we want to clone the other
			// control's text mesh:
			if (spriteText == null && c.spriteText != null)
			{
				GameObject newText = (GameObject)Instantiate(c.spriteText.gameObject);
				newText.transform.parent = transform;
				newText.transform.localPosition = c.spriteText.transform.localPosition;
				newText.transform.localScale = c.spriteText.transform.localScale;
				newText.transform.localRotation = c.spriteText.transform.localRotation;
			}

			if (spriteText != null)
				spriteText.Copy(c.spriteText);

			text = c.text;
			textOffsetZ = c.textOffsetZ;
			includeTextInAutoCollider = c.includeTextInAutoCollider;
		}

		if ((flags & ControlCopyFlags.Data) == ControlCopyFlags.Data)
		{
			data = c.data;
		}

		if ((flags & ControlCopyFlags.Appearance) == ControlCopyFlags.Appearance)
		{
			// See if we can copy the other control's collider's settings:
			if (c.collider != null)
			{
				// See if we don't already have a collider, in which case,
				// duplicate the one of the control being copied:
				if (collider == null)
				{
					gameObject.AddComponent(c.collider.GetType());
					customCollider = c.customCollider;
				}

				if (collider.GetType() == c.collider.GetType())
				{
					if (c.collider is BoxCollider)
					{
						if (collider == null)
							gameObject.AddComponent(typeof(BoxCollider));

						BoxCollider bc1 = (BoxCollider)collider;
						BoxCollider bc2 = (BoxCollider)c.collider;
						bc1.center = bc2.center;
						bc1.size = bc2.size;
					}
					else if (c.collider is SphereCollider)
					{
						if (collider == null)
							gameObject.AddComponent(typeof(SphereCollider));

						SphereCollider sc1 = (SphereCollider)collider;
						SphereCollider sc2 = (SphereCollider)c.collider;
						sc1.center = sc2.center;
						sc1.radius = sc2.radius;
					}
					else if (c.collider is MeshCollider)
					{
						if (collider == null)
							gameObject.AddComponent(typeof(MeshCollider));

						MeshCollider mc1 = (MeshCollider)collider;
						MeshCollider mc2 = (MeshCollider)c.collider;
						mc1.smoothSphereCollisions = mc2.smoothSphereCollisions;
						mc1.convex = mc2.convex;
						mc1.sharedMesh = mc2.sharedMesh;
					}
					else if (c.collider is CapsuleCollider)
					{
						if (collider == null)
							gameObject.AddComponent(typeof(CapsuleCollider));

						CapsuleCollider cc1 = (CapsuleCollider)collider;
						CapsuleCollider cc2 = (CapsuleCollider)c.collider;
						cc1.center = cc2.center;
						cc1.radius = cc2.radius;
						cc1.height = cc2.height;
						cc1.direction = cc2.direction;
					}

					if (collider != null)
						collider.isTrigger = c.collider.isTrigger;
				}
			}
			else if (Application.isPlaying) // Don't create a collider if we're in edit mode
			{
				// Create a default box collider to fit so
				// long as the control isn't of 0 size:
				if (collider == null &&
					width != 0 && height != 0 &&
					!float.IsNaN(width) && !float.IsNaN(height))
				{
					BoxCollider bc = (BoxCollider)gameObject.AddComponent(typeof(BoxCollider));
					bc.size = new Vector3(c.width, c.height, 0.001f);
					bc.center = c.GetCenterPoint();
					bc.isTrigger = true;
				}
				else
				{
					if (collider is BoxCollider)
					{
						BoxCollider bc = (BoxCollider)collider;
						bc.size = new Vector3(c.width, c.height, 0.001f);
						bc.center = c.GetCenterPoint();
					}
					else if (collider is SphereCollider)
					{
						SphereCollider sc = (SphereCollider)collider;
						sc.radius = Mathf.Max(c.width, c.height);
						sc.center = c.GetCenterPoint();
					}
					// Else Fuhgettaboutit
				}
			}
		}

		if ((flags & ControlCopyFlags.DragDrop) == ControlCopyFlags.DragDrop)
		{
			isDraggable = c.isDraggable;
			dragOffset = c.dragOffset;
			cancelDragEasing = c.cancelDragEasing;
			cancelDragDuration = c.cancelDragDuration;
		}

		if ((flags & ControlCopyFlags.Settings) == ControlCopyFlags.Settings)
		{
			detargetOnDisable = c.detargetOnDisable;
		}

		if ((flags & ControlCopyFlags.Invocation) == ControlCopyFlags.Invocation)
		{
			changeDelegate = c.changeDelegate;
			inputDelegate = c.inputDelegate;
		}

		if ((flags & ControlCopyFlags.State) == ControlCopyFlags.State ||
			(flags & ControlCopyFlags.Appearance) == ControlCopyFlags.Appearance)
		{
			Container = c.Container;

			if (Application.isPlaying)
			{
				controlIsEnabled = c.controlIsEnabled;
				Hide(c.IsHidden());
			}

			if (curAnim != null)
			{
				if (curAnim.index == -1)
				{
					if (c.curAnim != null)
						curAnim = c.curAnim.Clone();
					PlayAnim(curAnim);

				}
				else
					SetState(curAnim.index);
			}
			else
				SetState(0);
		}
		/*
				if (autoResize || pixelPerfect)
					CalcSize();
				else
					SetSize(s.width, s.height);
		*/
	}
    public virtual void Copy(IControl ctl, ControlCopyFlags flags)
    {
        if (!(ctl is ControlBase))
        {
            return;
        }
        ControlBase controlBase = (ControlBase)ctl;

        if ((flags & ControlCopyFlags.Transitions) == ControlCopyFlags.Transitions)
        {
            if (controlBase is UIStateToggleBtn3D)
            {
                if (controlBase.Transitions != null)
                {
                    ((UIStateToggleBtn3D)this).transitions = new EZTransitionList[controlBase.Transitions.Length];
                    for (int i = 0; i < this.Transitions.Length; i++)
                    {
                        controlBase.Transitions[i].CopyToNew(this.Transitions[i], true);
                    }
                }
            }
            else if (this.Transitions != null && controlBase.Transitions != null)
            {
                int num = 0;
                while (num < this.Transitions.Length && num < controlBase.Transitions.Length)
                {
                    controlBase.Transitions[num].CopyTo(this.Transitions[num], true);
                    num++;
                }
            }
        }
        if ((flags & ControlCopyFlags.Text) == ControlCopyFlags.Text)
        {
            if (this.spriteText == null && controlBase.spriteText != null)
            {
                GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate(controlBase.spriteText.gameObject);
                gameObject.transform.parent        = base.transform;
                gameObject.transform.localPosition = controlBase.spriteText.transform.localPosition;
                gameObject.transform.localScale    = controlBase.spriteText.transform.localScale;
                gameObject.transform.localRotation = controlBase.spriteText.transform.localRotation;
            }
            this.Text = controlBase.Text;
        }
        if ((flags & ControlCopyFlags.Appearance) == ControlCopyFlags.Appearance && base.collider.GetType() == controlBase.collider.GetType())
        {
            if (base.collider is BoxCollider)
            {
                BoxCollider boxCollider  = (BoxCollider)base.collider;
                BoxCollider boxCollider2 = (BoxCollider)controlBase.collider;
                boxCollider.center = boxCollider2.center;
                boxCollider.size   = boxCollider2.size;
            }
            else if (base.collider is SphereCollider)
            {
                SphereCollider sphereCollider  = (SphereCollider)base.collider;
                SphereCollider sphereCollider2 = (SphereCollider)controlBase.collider;
                sphereCollider.center = sphereCollider2.center;
                sphereCollider.radius = sphereCollider2.radius;
            }
            else if (base.collider is CapsuleCollider)
            {
                CapsuleCollider capsuleCollider  = (CapsuleCollider)base.collider;
                CapsuleCollider capsuleCollider2 = (CapsuleCollider)controlBase.collider;
                capsuleCollider.center    = capsuleCollider2.center;
                capsuleCollider.radius    = capsuleCollider2.radius;
                capsuleCollider.height    = capsuleCollider2.height;
                capsuleCollider.direction = capsuleCollider2.direction;
            }
            else if (base.collider is MeshCollider)
            {
                MeshCollider meshCollider  = (MeshCollider)base.collider;
                MeshCollider meshCollider2 = (MeshCollider)controlBase.collider;
                meshCollider.smoothSphereCollisions = meshCollider2.smoothSphereCollisions;
                meshCollider.convex     = meshCollider2.convex;
                meshCollider.sharedMesh = meshCollider2.sharedMesh;
            }
            base.collider.isTrigger = controlBase.collider.isTrigger;
        }
        if ((flags & ControlCopyFlags.Invocation) == ControlCopyFlags.Invocation)
        {
            this.changeDelegate = controlBase.changeDelegate;
            this.inputDelegate  = controlBase.inputDelegate;
        }
        if ((flags & ControlCopyFlags.State) == ControlCopyFlags.State)
        {
            this.Container = controlBase.Container;
            if (Application.isPlaying)
            {
                this.controlIsEnabled = controlBase.controlIsEnabled;
            }
        }
    }
Ejemplo n.º 27
0
	public override void Copy(SpriteRoot s, ControlCopyFlags flags)
	{
		base.Copy(s, flags);

		if (!(s is UIStateToggleBtn))
			return;

		UIStateToggleBtn b = (UIStateToggleBtn)s;

		if ((flags & ControlCopyFlags.Settings) == ControlCopyFlags.Settings)
		{
			defaultState = b.defaultState;
		}

		if ((flags & ControlCopyFlags.State) == ControlCopyFlags.State)
		{
			prevTransition = b.prevTransition;

			if (Application.isPlaying)
				SetToggleState(b.StateNum);
		}

		if ((flags & ControlCopyFlags.Invocation) == ControlCopyFlags.Invocation)
		{
			scriptWithMethodToInvoke = b.scriptWithMethodToInvoke;
			methodToInvoke = b.methodToInvoke;
			whenToInvoke = b.whenToInvoke;
			delay = b.delay;
		}

		if ((flags & ControlCopyFlags.Sound) == ControlCopyFlags.Sound)
		{
			soundToPlay = b.soundToPlay;
		}
	}
Ejemplo n.º 28
0
	public override void Copy(SpriteRoot s, ControlCopyFlags flags)
	{
		base.Copy(s, flags);

		if (!(s is UIScrollKnob))
			return;

		UIScrollKnob b = (UIScrollKnob)s;


		if ((flags & ControlCopyFlags.State) == ControlCopyFlags.State)
		{
			origPos = b.origPos;
			ctrlPlane = b.ctrlPlane;
			slider = b.slider;
		}

		if ((flags & ControlCopyFlags.Settings) == ControlCopyFlags.Settings)
		{
			maxScrollPos = b.maxScrollPos;
			colliderSizeFactor = b.colliderSizeFactor;
		}
	}
Ejemplo n.º 29
0
    public virtual void Copy(IControl ctl, ControlCopyFlags flags)
    {
        if (!(ctl is ControlBase))
        {
            return;
        }

        ControlBase c = (ControlBase)ctl;


        // Copy transitions:
        if ((flags & ControlCopyFlags.Transitions) == ControlCopyFlags.Transitions)
        {
            if (c is UIStateToggleBtn3D)
            {
                if (c.Transitions != null)
                {
                    ((UIStateToggleBtn3D)this).transitions = new EZTransitionList[c.Transitions.Length];
                    for (int i = 0; i < Transitions.Length; ++i)
                    {
                        c.Transitions[i].CopyToNew(Transitions[i], true);
                    }
                }
            }
            else
            {
                if (Transitions != null && c.Transitions != null)
                {
                    for (int i = 0; i < Transitions.Length && i < c.Transitions.Length; ++i)
                    {
                        c.Transitions[i].CopyTo(Transitions[i], true);
                    }
                }
            }
        }


        if ((flags & ControlCopyFlags.Text) == ControlCopyFlags.Text)
        {
            // See if we want to clone the other
            // control's text mesh:
            if (spriteText == null && c.spriteText != null)
            {
                GameObject newText = (GameObject)Instantiate(c.spriteText.gameObject);
                newText.transform.parent        = transform;
                newText.transform.localPosition = c.spriteText.transform.localPosition;
                newText.transform.localScale    = c.spriteText.transform.localScale;
                newText.transform.localRotation = c.spriteText.transform.localRotation;
            }

            Text = c.Text;
        }

        if ((flags & ControlCopyFlags.Appearance) == ControlCopyFlags.Appearance)
        {
            // See if we can copy the other control's collider's settings:
            if (collider.GetType() == c.collider.GetType())
            {
                if (collider is BoxCollider)
                {
                    BoxCollider bc1 = (BoxCollider)collider;
                    BoxCollider bc2 = (BoxCollider)c.collider;
                    bc1.center = bc2.center;
                    bc1.size   = bc2.size;
                }
                else if (collider is SphereCollider)
                {
                    SphereCollider sc1 = (SphereCollider)collider;
                    SphereCollider sc2 = (SphereCollider)c.collider;
                    sc1.center = sc2.center;
                    sc1.radius = sc2.radius;
                }
                else if (collider is CapsuleCollider)
                {
                    CapsuleCollider cc1 = (CapsuleCollider)collider;
                    CapsuleCollider cc2 = (CapsuleCollider)c.collider;
                    cc1.center    = cc2.center;
                    cc1.radius    = cc2.radius;
                    cc1.height    = cc2.height;
                    cc1.direction = cc2.direction;
                }
                else if (collider is MeshCollider)
                {
                    MeshCollider mc1 = (MeshCollider)collider;
                    MeshCollider mc2 = (MeshCollider)c.collider;
                    mc1.smoothSphereCollisions = mc2.smoothSphereCollisions;
                    mc1.convex     = mc2.convex;
                    mc1.sharedMesh = mc2.sharedMesh;
                }

                collider.isTrigger = c.collider.isTrigger;
            }
        }

        if ((flags & ControlCopyFlags.Invocation) == ControlCopyFlags.Invocation)
        {
            changeDelegate = c.changeDelegate;
            inputDelegate  = c.inputDelegate;
        }

        if ((flags & ControlCopyFlags.State) == ControlCopyFlags.State)
        {
            Container = c.Container;

            if (Application.isPlaying)
            {
                controlIsEnabled = c.controlIsEnabled;
            }
        }
    }
Ejemplo n.º 30
0
    /// <summary>
    /// Copies all of the specified control's settings
    /// to this control, provided they are of the same
    /// type.  One exception is that layers are not
    /// copied as this would require a new allocation
    /// and could negatively impact performance at
    /// runtime.
    /// </summary>
    /// <param name="s">Reference to the control whose settings are to be copied to this control.</param>
    public virtual void Copy(SpriteRoot s, ControlCopyFlags flags)
    {
        if ((flags & ControlCopyFlags.Appearance) == ControlCopyFlags.Appearance)
        {
            if (Application.isPlaying && s.Started)
            {
                base.Copy(s);
            }
            else             // If we're in-editor, copy the TextureAnims too
            {
                base.CopyAll(s);
            }

            if (!(s is AutoSpriteControlBase))
            {
                if (autoResize || pixelPerfect)
                {
                    CalcSize();
                }
                else
                {
                    SetSize(s.width, s.height);
                }

                SetBleedCompensation();

                return;
            }
        }



        AutoSpriteControlBase c = (AutoSpriteControlBase)s;

        // Copy transitions:
        if ((flags & ControlCopyFlags.Transitions) == ControlCopyFlags.Transitions)
        {
            if (c is UIStateToggleBtn || !Application.isPlaying)
            {
                if (c.Transitions != null)
                {
                    Transitions = new EZTransitionList[c.Transitions.Length];
                    for (int i = 0; i < Transitions.Length; ++i)
                    {
                        Transitions[i] = new EZTransitionList();
                        c.Transitions[i].CopyToNew(Transitions[i], true);
                    }
                }
            }
            else
            {
                if (Transitions != null && c.Transitions != null)
                {
                    for (int i = 0; i < Transitions.Length && i < c.Transitions.Length; ++i)
                    {
                        c.Transitions[i].CopyTo(Transitions[i], true);
                    }
                }
            }
        }


        if ((flags & ControlCopyFlags.Text) == ControlCopyFlags.Text)
        {
            // See if we want to clone the other
            // control's text mesh:
            if (spriteText == null && c.spriteText != null)
            {
                GameObject newText = (GameObject)Instantiate(c.spriteText.gameObject);
                newText.transform.parent        = transform;
                newText.transform.localPosition = c.spriteText.transform.localPosition;
                newText.transform.localScale    = c.spriteText.transform.localScale;
                newText.transform.localRotation = c.spriteText.transform.localRotation;
            }

            if (spriteText != null)
            {
                spriteText.Copy(c.spriteText);
            }
        }

        if ((flags & ControlCopyFlags.Data) == ControlCopyFlags.Data)
        {
            data = c.data;
        }

        if ((flags & ControlCopyFlags.Appearance) == ControlCopyFlags.Appearance)
        {
            // See if we can copy the other control's collider's settings:
            if (c.collider != null)
            {
                if (collider.GetType() == c.collider.GetType())
                {
                    if (c.collider is BoxCollider)
                    {
                        if (collider == null)
                        {
                            gameObject.AddComponent(typeof(BoxCollider));
                        }

                        BoxCollider bc1 = (BoxCollider)collider;
                        BoxCollider bc2 = (BoxCollider)c.collider;
                        bc1.center = bc2.center;
                        bc1.size   = bc2.size;
                    }
                    else if (c.collider is SphereCollider)
                    {
                        if (collider == null)
                        {
                            gameObject.AddComponent(typeof(SphereCollider));
                        }

                        SphereCollider sc1 = (SphereCollider)collider;
                        SphereCollider sc2 = (SphereCollider)c.collider;
                        sc1.center = sc2.center;
                        sc1.radius = sc2.radius;
                    }
                    else if (c.collider is MeshCollider)
                    {
                        if (collider == null)
                        {
                            gameObject.AddComponent(typeof(MeshCollider));
                        }

                        MeshCollider mc1 = (MeshCollider)collider;
                        MeshCollider mc2 = (MeshCollider)c.collider;
                        mc1.smoothSphereCollisions = mc2.smoothSphereCollisions;
                        mc1.convex     = mc2.convex;
                        mc1.sharedMesh = mc2.sharedMesh;
                    }
                    else if (c.collider is CapsuleCollider)
                    {
                        if (collider == null)
                        {
                            gameObject.AddComponent(typeof(CapsuleCollider));
                        }

                        CapsuleCollider cc1 = (CapsuleCollider)collider;
                        CapsuleCollider cc2 = (CapsuleCollider)c.collider;
                        cc1.center    = cc2.center;
                        cc1.radius    = cc2.radius;
                        cc1.height    = cc2.height;
                        cc1.direction = cc2.direction;
                    }

                    if (collider != null)
                    {
                        collider.isTrigger = c.collider.isTrigger;
                    }
                }
            }
            else if (Application.isPlaying)            // Don't create a collider if we're in edit mode
            {
                // Create a default box collider to fit so
                // long as the control isn't of 0 size:
                if (collider == null &&
                    width != 0 && height != 0 &&
                    !float.IsNaN(width) && !float.IsNaN(height))
                {
                    BoxCollider bc = (BoxCollider)gameObject.AddComponent(typeof(BoxCollider));
                    bc.size      = new Vector3(c.width, c.height, 0.001f);
                    bc.center    = c.GetCenterPoint();
                    bc.isTrigger = true;
                }
                else
                {
                    if (collider is BoxCollider)
                    {
                        BoxCollider bc = (BoxCollider)collider;
                        bc.size   = new Vector3(c.width, c.height, 0.001f);
                        bc.center = c.GetCenterPoint();
                    }
                    else if (collider is SphereCollider)
                    {
                        SphereCollider sc = (SphereCollider)collider;
                        sc.radius = Mathf.Max(c.width, c.height);
                        sc.center = c.GetCenterPoint();
                    }
                    // Else Fuhgettaboutit
                }
            }
        }

        if ((flags & ControlCopyFlags.Invocation) == ControlCopyFlags.Invocation)
        {
            changeDelegate = c.changeDelegate;
            inputDelegate  = c.inputDelegate;
        }

        if ((flags & ControlCopyFlags.State) == ControlCopyFlags.State ||
            (flags & ControlCopyFlags.Appearance) == ControlCopyFlags.Appearance)
        {
            Container = c.Container;

            if (Application.isPlaying)
            {
                controlIsEnabled = c.controlIsEnabled;
                Hide(c.IsHidden());
            }

            if (curAnim != null)
            {
                if (curAnim.index == -1)
                {
                    PlayAnim(curAnim);
                }
                else
                {
                    SetState(curAnim.index);
                }
            }
            else
            {
                SetState(0);
            }
        }

/*
 *              if (autoResize || pixelPerfect)
 *                      CalcSize();
 *              else
 *                      SetSize(s.width, s.height);
 */
    }