当前位置: 首页>>代码示例>>C#>>正文


C# CONTROL_STATE类代码示例

本文整理汇总了C#中CONTROL_STATE的典型用法代码示例。如果您正苦于以下问题:C# CONTROL_STATE类的具体用法?C# CONTROL_STATE怎么用?C# CONTROL_STATE使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CONTROL_STATE类属于命名空间,在下文中一共展示了CONTROL_STATE类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Start

	public override void Start()
	{
		base.Start();

		state = controlIsEnabled ? (btnValue ? CONTROL_STATE.True : CONTROL_STATE.False) : CONTROL_STATE.Disabled;
		/*
				if (btnValue)
					PopOtherButtonsInGroup();
		*/

		// Runtime init stuff:
		if (Application.isPlaying)
		{
			// Setup our transitions:
			for (int i = 0; i < transitions.Length; ++i)
				for (int j = 0; j < transitions[i].list.Length; ++j)
				{
					transitions[i].list[j].MainSubject = this.gameObject;

					// Add our text as a sub-subject of our transitions:
					if (spriteText != null)
						transitions[i].list[j].AddSubSubject(spriteText.gameObject);
				}

			// We'll use this to setup our state:
			int stateIdx = btnValue ? 0 : 1;
			stateIdx = m_controlIsEnabled ? stateIdx : 2;

			// Create a default collider if none exists:
			if (collider == null)
			{
				AddCollider();
			}

			//SetState(stateIdx);
		}

		Value = btnValue;

		if (useParentForGrouping && transform.parent != null)
			SetGroup(transform.parent.GetHashCode());
		else
			SetGroup(radioGroup);
	}
开发者ID:juliancruz87,项目名称:Ataraxia,代码行数:44,代码来源:UIRadioBtn3D.cs

示例2: SetButtonState

	// Sets the button's visual state to match its value.
	protected virtual void SetButtonState()
	{
		int prevState = (int)state;
		state = controlIsEnabled ? (btnValue ? CONTROL_STATE.True : CONTROL_STATE.False) : CONTROL_STATE.Disabled;

		int index = (int)state;

		// First see if we need to postpone this state
		// change for when we are active:
#if UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_4_9
		if (!gameObject.activeInHierarchy)
#else
		if (!gameObject.active)
#endif
		{
			stateChangeWhileDeactivated = true;
			return;
		}

		this.UseStateLabel(index);

		// End any current transition:
		if (prevTransition != null)
			prevTransition.StopSafe();

		StartTransition(index, prevState);
	}
开发者ID:juliancruz87,项目名称:Ataraxia,代码行数:28,代码来源:UIRadioBtn3D.cs

示例3: SetState

    public void SetState(CONTROL_STATE s)
    {
        switch (s)
        {
            case CONTROL_STATE.NORMAL:
                if (m_ButtonImage != null && m_ButtonImage.Length > 0)
                {
                    for (int i = 0, iMax = m_ButtonImage.Length; i < iMax; ++i)
                        m_ButtonImage[i].target.spriteName = m_ButtonImage[i].normalSprite;
                }
                break;
            case CONTROL_STATE.OVER:
                if (m_ButtonImage != null && m_ButtonImage.Length > 0)
                {
                    for (int i = 0, iMax = m_ButtonImage.Length; i < iMax; ++i)
                        m_ButtonImage[i].target.spriteName = m_ButtonImage[i].hoverSprite;
                }
                break;
            case CONTROL_STATE.ACTIVE:
                if (m_ButtonImage != null && m_ButtonImage.Length > 0)
                {
                    for (int i = 0, iMax = m_ButtonImage.Length; i < iMax; ++i)
                        m_ButtonImage[i].target.spriteName = m_ButtonImage[i].pressedSprite;
                }
                break;
            case CONTROL_STATE.DISABLED:
                if (m_ButtonImage != null && m_ButtonImage.Length > 0)
                {
                    for (int i = 0, iMax = m_ButtonImage.Length; i < iMax; ++i)
                        m_ButtonImage[i].target.spriteName = m_ButtonImage[i].disabledSprite;
                }
                break;
            default:
                break;

        }
    }
开发者ID:ancongsheng,项目名称:vu_paradox,代码行数:37,代码来源:XUIButton.cs

示例4: DisableMe

	// Sets the control to its disabled appearance:
	protected void DisableMe()
	{
		// End any current transition:
		if (prevTransition != null)
			prevTransition.StopSafe();

		StartTransition((int)CONTROL_STATE.Disabled, (int)state);

		state = CONTROL_STATE.Disabled;
	}
开发者ID:robert-irribarren,项目名称:TraumaOR,代码行数:11,代码来源:UIRadioBtn3D.cs

示例5: Start

	public override void Start()
	{
		if (m_started)
			return;

		base.Start();

		// Assign our aggregate layers:
		aggregateLayers = new SpriteRoot[1][];
		aggregateLayers[0] = layers;

		state = controlIsEnabled ? (btnValue ? CONTROL_STATE.True : CONTROL_STATE.False) : CONTROL_STATE.Disabled;
/*
		if (btnValue)
			PopOtherButtonsInGroup();
*/

		// Runtime init stuff:
		if (Application.isPlaying)
		{
			// Setup our transitions:
			for (int i = 0; i < transitions.Length; ++i)
				for (int j = 0; j < transitions[i].list.Length; ++j)
				{
					transitions[i].list[j].MainSubject = this.gameObject;

					// Add our text as a sub-subject of our transitions:
					if (spriteText != null)
						transitions[i].list[j].AddSubSubject(spriteText.gameObject);
				}

			// Add our text as a sub-subject of our transitions:

			stateIndices = new int[layers.Length, 5];

			// We'll use this to setup our state:
			int stateIdx = btnValue ? 0 : 1;
			stateIdx = m_controlIsEnabled ? stateIdx : 2;

			// Populate our state indices based on if we
			// find any valid states/animations in each 
			// sprite layer:
			for (int i = 0; i < layers.Length; ++i)
			{
				if (layers[i] == null)
				{
					Debug.LogError("A null layer sprite was encountered on control \"" + name + "\". Please fill in the layer reference, or remove the empty element.");
					continue;
				}

				stateIndices[i, 0] = layers[i].GetStateIndex("true");
				stateIndices[i, 1] = layers[i].GetStateIndex("false");
				stateIndices[i, 2] = layers[i].GetStateIndex("disabled");
				stateIndices[i, 3] = layers[i].GetStateIndex("over");
				stateIndices[i, 4] = layers[i].GetStateIndex("active");

				// Add this as a subject of our transition for 
				// each state, as appropriate:
				if (stateIndices[i, 0] != -1)
				{
					transitions[0].list[0].AddSubSubject(layers[i].gameObject);
					transitions[0].list[1].AddSubSubject(layers[i].gameObject);
				}
				if (stateIndices[i, 1] != -1)
				{
					transitions[1].list[0].AddSubSubject(layers[i].gameObject);
					transitions[1].list[1].AddSubSubject(layers[i].gameObject);
				}
				if (stateIndices[i, 2] != -1)
				{
					transitions[2].list[0].AddSubSubject(layers[i].gameObject);
					transitions[2].list[1].AddSubSubject(layers[i].gameObject);
				}

				// Set the layer's state:
				if (stateIndices[i, stateIdx] != -1)
					layers[i].SetState(stateIndices[i, stateIdx]);
				else
					layers[i].Hide(true);
			}

			// Create a default collider if none exists:
			if (collider == null)
				AddCollider();

			SetValue(btnValue, true);

			if (useParentForGrouping && transform.parent != null)
				SetGroup(transform.parent.GetHashCode());
			else
				SetGroup(radioGroup);
		}

		// Since hiding while managed depends on
		// setting our mesh extents to 0, and the
		// foregoing code causes us to not be set
		// to 0, re-hide ourselves:
		if (managed && m_hidden)
			Hide(true);
	}
开发者ID:MtvnGames,项目名称:marblemadness,代码行数:100,代码来源:UIRadioBtn.cs

示例6: SetLayerState

	// Sets the layers to represent the current control state
	// (includes states not directly supported by the control
	// itself, such as Over and Active)
	protected void SetLayerState(CONTROL_STATE s)
	{
		// Skip if redundant:
		if (s == layerState)
			return;

		layerState = s;

		// This index is valid for our layers as
		// they can also support "Over" and "Active":
		int layerIndex = (int)layerState;

		// Loop through each layer and set its state,
		// provided we have a valid index for that state:
		for (int i = 0; i < layers.Length; ++i)
		{
			if (-1 != stateIndices[i, layerIndex])
			{
				layers[i].Hide(IsHidden());
				layers[i].SetState(stateIndices[i, layerIndex]);
			}
			else
				layers[i].Hide(true);
		}
	}
开发者ID:MtvnGames,项目名称:marblemadness,代码行数:28,代码来源:UIRadioBtn.cs

示例7: SetControlState

	public virtual void SetControlState(CONTROL_STATE s)
	{
		SetControlState(s, false);
	}
开发者ID:amutnick,项目名称:CrackTheCode_Repo,代码行数:4,代码来源:UIButton.cs

示例8: SetButtonState

	// Sets the button's visual state to match its value.
	protected void SetButtonState()
	{
		// Make sure we have a mesh:
		if (spriteMesh == null)
			return;

		// Make sure we're initialized since
		// we might have been called as a result of
		// another button in our group settings its
		// value on Start() before we've had a cance
		// to Start() ourselves, meaning we may lack
		// important info like a valid screensize,
		// etc. which is necessary for sizing or else
		// we'll get vertices of "infinite" value
		// resulting in a !local.IsValid() error:
		if (!m_started)
			return;

		int prevState = (int)state;
		state = controlIsEnabled ? (btnValue ? CONTROL_STATE.True : CONTROL_STATE.False) : CONTROL_STATE.Disabled;

		int index = (int)state;

		this.SetState(index);

		this.UseStateLabel(index);

		// Recalculate our collider
		UpdateCollider();

		// Loop through each layer and set its state,
		// provided we have a valid index for that state:
		for (int i = 0; i < layers.Length; ++i)
		{
			if (-1 != stateIndices[i, index])
			{
				layers[i].Hide(false);
				layers[i].SetState(stateIndices[i, index]);
			}
			else
				layers[i].Hide(true);
		}

		// End any current transition:
		if (prevTransition != null)
			prevTransition.StopSafe();

		StartTransition(index, prevState);

		// Notify our change delegate:
		if (changeDelegate != null)
			changeDelegate(this);
	}
开发者ID:robert-irribarren,项目名称:TraumaOR,代码行数:54,代码来源:UIRadioBtn.cs

示例9: SetControlState

	// Switches the displayed sprite(s) to match the current state:
	protected void SetControlState(CONTROL_STATE s)
	{
		// If this is the same as the current state, ignore:
		if (m_ctrlState == s)
			return;

		int prevState = (int)m_ctrlState;

		m_ctrlState = s;

		// End any current transition:
		if (prevTransition != null)
			prevTransition.StopSafe();

		// Start a new transition:
		StartTransition((int)s, prevState);
	}
开发者ID:robert-irribarren,项目名称:TraumaOR,代码行数:18,代码来源:UIButton3D.cs

示例10: OnEnable

	protected override void OnEnable()
	{
		base.OnEnable();

		if (Application.isPlaying && m_started)
		{
			// Set it to some bogus value so we can force
			// it to be reset:
			m_ctrlState = (CONTROL_STATE)(-1);

			if (controlIsEnabled)
				SetControlState(CONTROL_STATE.NORMAL, true);
			else
				SetControlState(CONTROL_STATE.DISABLED, true);
		}
	}
开发者ID:amutnick,项目名称:CrackTheCode_Repo,代码行数:16,代码来源:UIButton.cs

示例11: QueueTransition

	// Queues a transition to play following the previous (currently-running) transition
	protected void QueueTransition(int newState, int prevState)
	{
		if (deleted)
			return;

		nextTransition = transitions[newState].list[DetermineNextTransition(newState, prevState)];
		nextState = (CONTROL_STATE)newState;

		// See if we've already queued to run a follow-up transition:
		if (!transitionQueued)
			prevTransition.AddTransitionEndDelegate(RunFollowupTrans);

		transitionQueued = true;
	}
开发者ID:stevesolomon,项目名称:MicroDungeonPrototype,代码行数:15,代码来源:UIButton3D.cs

示例12: SetControlState

	public virtual void SetControlState(CONTROL_STATE s, bool suppressTransitions)
	{
		// If this is the same as the current state, ignore:
		if (m_ctrlState == s)
			return;

		// Only stop our transition if it isn't an active state
		// transition and we don't want it to run to completion:
		if (!(alwaysFinishActiveTransition &&
			(prevTransition == transitions[(int)UIButton.CONTROL_STATE.ACTIVE].list[0] ||
			 prevTransition == transitions[(int)UIButton.CONTROL_STATE.ACTIVE].list[1])
			))
		{

			int prevState = (int)m_ctrlState;

			m_ctrlState = s;

			this.UseStateLabel((int)s);

			if (s == CONTROL_STATE.DISABLED)
				m_controlIsEnabled = false;
			else
				m_controlIsEnabled = true;

			// Go no further if we're suppressing transitions:
			if (suppressTransitions)
				return;

			// End any current transition:
			if (prevTransition != null)
				prevTransition.StopSafe();

			// Start a new transition:
			StartTransition((int)s, prevState);
		}
		else  // Else, have our desired transition run when the active transition is complete:
		{
			// Go no further if we're suppressing transitions:
			if (suppressTransitions)
				return;
			QueueTransition((int)s, (int)UIButton.CONTROL_STATE.ACTIVE);
		}
	}
开发者ID:stevesolomon,项目名称:MicroDungeonPrototype,代码行数:44,代码来源:UIButton3D.cs

示例13: SetControlState

	// Switches the displayed sprite(s) to match the current state:
	public void SetControlState(CONTROL_STATE s)
	{
		// If this is the same as the current state, ignore:
		if (m_ctrlState == s)
			return;

		int prevState = (int)m_ctrlState;

		m_ctrlState = s;

		// Validate that we can go to this appearance:
		if(animations[(int)s].GetFrameCount() > 0)
			this.SetState((int)s);

		this.UseStateLabel((int)s);

		if (s == CONTROL_STATE.DISABLED)
			m_controlIsEnabled = false;
		else
			m_controlIsEnabled = true;

		// Recalculate our collider
		UpdateCollider();

		// Loop through each layer and set its state,
		// provided we have a valid index for that state:
		for (int i = 0; i < layers.Length; ++i)
		{
			if (-1 != stateIndices[i, (int)s])
			{
				layers[i].Hide(false);
				layers[i].SetState(stateIndices[i, (int)s]);
			}
			else
				layers[i].Hide(true);
		}

		// End any current transition:
		if (prevTransition != null)
			prevTransition.StopSafe();

		// Start a new transition:
		StartTransition((int)s, prevState);
	}
开发者ID:robert-irribarren,项目名称:TraumaOR,代码行数:45,代码来源:UIButton.cs

示例14: DisableMe

	// Sets the control to its disabled appearance:
	protected void DisableMe()
	{
		this.UseStateLabel(states.Length - 1);

		// End any current transition:
		if (prevTransition != null)
			prevTransition.StopSafe();

		StartTransition((int)CONTROL_STATE.Disabled, (int)state);

		state = CONTROL_STATE.Disabled;
	}
开发者ID:juliancruz87,项目名称:Ataraxia,代码行数:13,代码来源:UIRadioBtn3D.cs

示例15: Start

	protected override void Start()
	{
		base.Start();

		// Assign our aggregate layers:
		aggregateLayers = new SpriteRoot[1][];
		aggregateLayers[0] = layers;

		state = controlIsEnabled ? (btnValue ? CONTROL_STATE.True : CONTROL_STATE.False) : CONTROL_STATE.Disabled;
/*
		if (btnValue)
			PopOtherButtonsInGroup();
*/

		// Runtime init stuff:
		if (Application.isPlaying)
		{
			// Setup our transitions:
			transitions[0].list[0].MainSubject = this.gameObject;
			transitions[1].list[0].MainSubject = this.gameObject;
			transitions[2].list[0].MainSubject = this.gameObject;
			transitions[2].list[1].MainSubject = this.gameObject;

			stateIndices = new int[layers.Length, 3];

			// We'll use this to setup our state:
			int stateIdx = btnValue ? 0 : 1;
			stateIdx = m_controlIsEnabled ? stateIdx : 2;

			// Populate our state indices based on if we
			// find any valid states/animations in each 
			// sprite layer:
			for (int i = 0; i < layers.Length; ++i)
			{
				if (layers[i] == null)
				{
					Debug.LogError("A null layer sprite was encountered on control \"" + name + "\". Please fill in the layer reference, or remove the empty element.");
					continue;
				}

				stateIndices[i, 0] = layers[i].GetStateIndex("true");
				stateIndices[i, 1] = layers[i].GetStateIndex("false");
				stateIndices[i, 2] = layers[i].GetStateIndex("disabled");

				// Add this as a subject of our transition for 
				// each state, as appropriate:
				if (stateIndices[i, 0] != -1)
					transitions[0].list[0].AddSubSubject(layers[i].gameObject);
				if (stateIndices[i, 1] != -1)
					transitions[1].list[0].AddSubSubject(layers[i].gameObject);
				if (stateIndices[i, 2] != -1)
				{
					transitions[2].list[0].AddSubSubject(layers[i].gameObject);
					transitions[2].list[1].AddSubSubject(layers[i].gameObject);
				}

				// Set the layer's state:
				if (stateIndices[i, stateIdx] != -1)
					layers[i].SetState(stateIndices[i, stateIdx]);
				else
					layers[i].Hide(true);
			}

			// Create a default collider if none exists:
			if (collider == null)
				AddCollider();

			Value = btnValue;
		}
	}
开发者ID:robert-irribarren,项目名称:TraumaOR,代码行数:70,代码来源:UIRadioBtn.cs


注:本文中的CONTROL_STATE类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。