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


C# Component.ToString方法代码示例

本文整理汇总了C#中Component.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Component.ToString方法的具体用法?C# Component.ToString怎么用?C# Component.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Component的用法示例。


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

示例1: AddComponent

    public static Component AddComponent(GameObject tarObject, Component srcCom)
    {
        if (srcCom.ToString().Contains("EllipsoidParticleEmitter"))
            return tarObject.AddComponent("EllipsoidParticleEmitter");
        if (srcCom.ToString().Contains("MeshParticleEmitter"))
            return tarObject.AddComponent("MeshParticleEmitter");
        if (srcCom.ToString().Contains("WorldParticleCollider"))
            return tarObject.AddComponent("WorldParticleCollider");
        Component com = tarObject.AddComponent(srcCom.GetType());

        return com;
    }
开发者ID:hugobozzshih007,项目名称:BattleCard,代码行数:12,代码来源:NgSerialized.cs

示例2: AddComponent

    public static Component AddComponent(GameObject tarObject, Component srcCom)
    {
        if (srcCom.ToString().Contains("EllipsoidParticleEmitter"))
            return tarObject.AddComponent<EllipsoidParticleEmitter>();
        if (srcCom.ToString().Contains("MeshParticleEmitter"))
            return tarObject.AddComponent<MeshParticleEmitter>();
        if (srcCom.ToString().Contains("WorldParticleCollider"))
            return UnityEngineInternal.APIUpdaterRuntimeServices.AddComponent(tarObject, "Assets/IGSoft_Tools/CommonLib/GlobalScript/NgSerialized.cs (190,11)", "WorldParticleCollider");
        Component com = tarObject.AddComponent(srcCom.GetType());

        return com;
    }
开发者ID:seonwifi,项目名称:bongbong,代码行数:12,代码来源:NgSerialized.cs

示例3: GetScriptName

	protected string GetScriptName(Component com)
	{
		string	name	= com.ToString();
		int		start	= name.IndexOf('(');
		int		end		= name.IndexOf(')');
		return name.Substring(start+1, end-start-1);
	}
开发者ID:w405229619,项目名称:The-revenge-of-DaNiu,代码行数:7,代码来源:FXMakerEditor.cs

示例4: GetScriptName

	protected string GetScriptName(Component com)
	{
		string	name	= com.ToString();
		int		idx		= 0;

		for (int n = 0; n < name.Length; n++)
		{
			if (name[n] == '(')
				idx = n;
		}
		int		start	= name.IndexOf('(', idx);
		int		end		= name.IndexOf(')', idx);
		return name.Substring(start+1, end-start-1);
	}
开发者ID:Henry-T,项目名称:UnityPG,代码行数:14,代码来源:FXMakerEditor.cs

示例5: FromComponent

		public static HelpInfo FromComponent(Component cmp)
		{
			if (cmp == null) return null;
			HelpInfo info = FromMember(cmp.GetType()) ?? new HelpInfo();

			info.topic = cmp.ToString();

			return info;
		}
开发者ID:ChrisLakeZA,项目名称:duality,代码行数:9,代码来源:HelpInfo.cs

示例6: ValidateNumericComponent

 protected void ValidateNumericComponent(Component component)
 {
     long result;
     if (long.TryParse(components[component], out result) == false)
         throw new FormatException(string.Format("{0} component is not an integer.", component));
     if (result < 0)
         throw new ArgumentOutOfRangeException(component.ToString(), string.Format("{0} component is less than zero.", component));
     if (result > int.MaxValue)
         throw new OverflowException(string.Format("{0} component is larger than MaxValue.", component));
 }
开发者ID:vsite-pood,项目名称:vcb4,代码行数:10,代码来源:VersionBase.cs

示例7: ComponentField

    public static Component ComponentField( string label, Component value, Type componentType )
    {
        componentType = componentType ?? typeof( MonoBehaviour );

        EditorGUILayout.BeginHorizontal();
        {

            EditorGUILayout.LabelField( label, "", GUILayout.Width( dfEditorUtil.LabelWidth - 10 ) );

            GUILayout.Space( 5 );

            var displayText = value == null ? "[none]" : value.ToString();
            GUILayout.Label( displayText, "TextField", GUILayout.ExpandWidth( true ), GUILayout.MinWidth( 100 ) );

            var evt = Event.current;
            if( evt != null )
            {
                var textRect = GUILayoutUtility.GetLastRect();
                if( evt.type == EventType.mouseDown && evt.clickCount == 2 )
                {
                    if( textRect.Contains( evt.mousePosition ) )
                    {
                        if( GUI.enabled && value != null )
                        {
                            Selection.activeObject = value;
                            EditorGUIUtility.PingObject( value );
                            GUIUtility.hotControl = value.GetInstanceID();
                        }
                    }
                }
                else if( evt.type == EventType.DragUpdated || evt.type == EventType.DragPerform )
                {
                    if( textRect.Contains( evt.mousePosition ) )
                    {

                        var reference = DragAndDrop.objectReferences.First();
                        var draggedComponent = (Component)null;
                        if( reference is Transform )
                        {
                            draggedComponent = (Transform)reference;
                        }
                        else if( reference is GameObject )
                        {
                            draggedComponent =
                                ( (GameObject)reference )
                                .GetComponents( componentType )
                                .FirstOrDefault();
                        }
                        else if( reference is Component )
                        {
                            draggedComponent = reference as Component;
                            if( draggedComponent == null )
                            {
                                draggedComponent =
                                    ( (Component)reference )
                                    .GetComponents( componentType )
                                    .FirstOrDefault();
                            }
                        }

                        DragAndDrop.visualMode = ( draggedComponent == null ) ? DragAndDropVisualMode.None : DragAndDropVisualMode.Copy;

                        if( evt.type == EventType.DragPerform )
                        {
                            value = draggedComponent;
                        }

                        evt.Use();

                    }
                }
            }

            GUI.enabled = ( clipboard != null );
            {
                var tooltip = ( clipboard != null ) ? string.Format( "Paste {0} ({1})", clipboard.name, clipboard.GetType().Name ) : "";
                var content = new GUIContent( "Paste", tooltip );
                if( GUILayout.Button( content, "minibutton", GUILayout.Width( 50 ) ) )
                {
                    value = clipboard;
                }
            }
            GUI.enabled = true;

        }
        EditorGUILayout.EndHorizontal();

        GUILayout.Space( 3 );

        return value;
    }
开发者ID:BjarkeHou,项目名称:ProjectGuard,代码行数:91,代码来源:dfEditorUtil.cs

示例8: IsValidCopy

	public static bool IsValidCopy(Component tarCom, Component srcCom)
	{
		if (tarCom == null || srcCom == null)
		{
			Debug.LogWarning("arg is null!!!");
			return false;
		}

		if (srcCom.ToString().Contains("EllipsoidParticleEmitter") || srcCom.ToString().Contains("MeshParticleEmitter"))
		{
			return srcCom.ToString().Contains("EllipsoidParticleEmitter") == srcCom.ToString().Contains("EllipsoidParticleEmitter");
		}
		return true;
	}
开发者ID:w405229619,项目名称:The-revenge-of-DaNiu,代码行数:14,代码来源:NgSerialized.cs

示例9: ComponentField

	private Component ComponentField(string label, Component value, Type componentType = null)
	{
		componentType = componentType ?? typeof(MonoBehaviour);

		EditorGUILayout.BeginHorizontal();
		{
			EditorGUILayout.LabelField(label, "", GUILayout.Width(90));

			GUILayout.Space(5);

			var displayText = value == null ? "[none] - Drag Component Here" : value.ToString();
			GUILayout.Label(displayText, "TextField", GUILayout.ExpandWidth(true), GUILayout.MinWidth(100));

			var evt = Event.current;
			if(evt != null)
			{
				var textRect = GUILayoutUtility.GetLastRect();
				if(evt.type == EventType.mouseDown && evt.clickCount == 2)
				{
					if(textRect.Contains(evt.mousePosition))
					{
						if(GUI.enabled && value != null)
						{
							Selection.activeObject = value;
							EditorGUIUtility.PingObject( value );
							GUIUtility.hotControl = value.GetInstanceID();
						}
					}
				}
				else if(evt.type == EventType.DragUpdated || evt.type == EventType.DragPerform)
				{
					if(textRect.Contains(evt.mousePosition))
					{

						var reference = DragAndDrop.objectReferences.First();
						var draggedComponent = (Component)null;
						if(reference is Transform)
						{
							draggedComponent = (Transform)reference;
						}
						else if(reference is GameObject)
						{
							draggedComponent =
								( (GameObject)reference )
								.GetComponents( componentType )
								.FirstOrDefault();
						}
						else if(reference is Component)
						{
							draggedComponent = reference as Component;
							if(draggedComponent == null)
							{
								draggedComponent =
									((Component)reference)
									.GetComponents(componentType)
									.FirstOrDefault();
							}
						}

						DragAndDrop.visualMode = (draggedComponent == null) ? DragAndDropVisualMode.None : DragAndDropVisualMode.Copy;

						if(evt.type == EventType.DragPerform)
						{
							value = draggedComponent;
						}
						
						evt.Use();
					}
				}
			}
		}
		EditorGUILayout.EndHorizontal();

		GUILayout.Space(3);

		return value;
	}
开发者ID:Wuzseen,项目名称:Circuit-Math,代码行数:77,代码来源:AudioSourceProEditor.cs

示例10: SetPlayer

    public void SetPlayer(int controlNumber, Character chosenChar, bool mpu, string com)
    {
        controllerNumber = controlNumber;
        chosenCharacter = chosenChar;
        switch (chosenCharacter)
        {
            case Character.LEPRECHAUN_01:
                loadCharacterString = "Prefabs/Entities/Leprechaun_01";
                
                healthHUD = Instantiate(Resources.Load("Prefabs/Objects/HUD/HUD_health_leprechaun01"), new Vector3(-10 + (4 * controllerNumber), -3, -9), Quaternion.identity) as GameObject;
                healthHUD.transform.parent = Camera.main.transform;
                healthHUDScript = healthHUD.GetComponentInChildren<HealthHUD>();
                healthHUDScript.SetHealthHud(controllerNumber);
                break;
            case Character.LEPRECHAUN_USA:
                loadCharacterString = "Prefabs/Entities/Leprechaun_usa";
                
                healthHUD = Instantiate(Resources.Load("Prefabs/Objects/HUD/HUD_health_leprechaunusa"), new Vector3(-10 + (4 * controllerNumber), -3, -9), Quaternion.identity) as GameObject;
                healthHUD.transform.parent = Camera.main.transform;
                healthHUDScript = healthHUD.GetComponentInChildren<HealthHUD>();
                healthHUDScript.SetHealthHud(controllerNumber);
                break;
            case Character.CLUIRICHAUN:
                loadCharacterString = "Prefabs/Entities/Cluirichaun";
                
                healthHUD = Instantiate(Resources.Load("Prefabs/Objects/HUD/HUD_health_cluirichaun"), new Vector3(-10 + (4 * controllerNumber), -3, -9), Quaternion.identity) as GameObject;
                healthHUD.transform.parent = Camera.main.transform;
                healthHUDScript = healthHUD.GetComponentInChildren<HealthHUD>();
                healthHUDScript.SetHealthHud(controllerNumber);
                break;
            case Character.FAR_DARRIG:
                loadCharacterString = "Prefabs/Entities/FarDarrig";
                
                healthHUD = Instantiate(Resources.Load("Prefabs/Objects/HUD/HUD_health_fardarrig"), new Vector3(-10 + (4 * controllerNumber), -3, -9), Quaternion.identity) as GameObject;
                healthHUD.transform.parent = Camera.main.transform;
                healthHUDScript = healthHUD.GetComponentInChildren<HealthHUD>();
                healthHUDScript.SetHealthHud(controllerNumber);
                break;
            case Character.FAIRY:
                loadCharacterString = "Prefabs/Entities/Fairy";
                
                healthHUD = Instantiate(Resources.Load("Prefabs/Objects/HUD/HUD_health_fairy"), new Vector3(-10 + (4 * controllerNumber), -3, -9), Quaternion.identity) as GameObject;
                healthHUD.transform.parent = Camera.main.transform;
                healthHUDScript = healthHUD.GetComponentInChildren<HealthHUD>();
                healthHUDScript.SetHealthHud(controllerNumber);
                break;
            default:
                loadCharacterString = "Prefabs/Entities/Leprechaun_01";
                
                healthHUD = Instantiate(Resources.Load("Prefabs/Objects/HUD/HUD_health_leprechaun01"), new Vector3(-10 + (5 * controllerNumber), -3, -9), Quaternion.identity) as GameObject;
                healthHUD.transform.parent = Camera.main.transform;
                healthHUDScript = healthHUD.GetComponentInChildren<HealthHUD>();
                healthHUDScript.SetHealthHud(controllerNumber);
                print("You done goofed hard.");
                break;
        }

        RESET = false;
        useMpu = mpu;
        if (useMpu)
        {
            COMParser compars = gameObject.AddComponent<COMParser>();
            compars.com = com;
            mpuController = gameObject.AddComponent<MPUController>();
        }
        kills = 0;



        playerStartPosition = new Vector3(-10 + (4 * controllerNumber), 0, (-.1f * controllerNumber));
        gameObject.transform.position = playerStartPosition;

        leprechaunObject = Instantiate(Resources.Load(loadCharacterString), transform.position, Quaternion.identity) as GameObject;
        leprechaunObject.transform.parent = gameObject.transform;
        switch (chosenCharacter)
        {
            case Character.LEPRECHAUN_01:
                leprechaunScript = leprechaunObject.AddComponent<Leprechaun>();
                Global.lepGOlepScript.Add(leprechaunObject, leprechaunScript.ToString());
                leprechaunScript.GetComponent<Leprechaun>().SetLeprechaun(playerStartPosition, controllerNumber, chosenCharacter, gameObject);
                break;
            case Character.LEPRECHAUN_USA:
                leprechaunScript = leprechaunObject.AddComponent<Leprechaun_USA>();
                Global.lepGOlepScript.Add(leprechaunObject, leprechaunScript.ToString());
                leprechaunScript.GetComponent<Leprechaun_USA>().SetLeprechaun_USA(playerStartPosition, controllerNumber, chosenCharacter, gameObject);
                break;
            case Character.CLUIRICHAUN:
                leprechaunScript = leprechaunObject.AddComponent<Cluirichaun>();
                Global.lepGOlepScript.Add(leprechaunObject, leprechaunScript.ToString());
                leprechaunScript.GetComponent<Cluirichaun>().SetCluirichaun(playerStartPosition, controllerNumber, chosenCharacter, gameObject);
                gameObject.GetComponent<BoxCollider2D>().size = leprechaunScript.GetComponent<Cluirichaun>().bodyCheck.GetComponent<BoxCollider2D>().size;
                gameObject.GetComponent<BoxCollider2D>().center = leprechaunScript.GetComponent<Cluirichaun>().bodyCheck.GetComponent<BoxCollider2D>().center;
                break;
            case Character.FAR_DARRIG:
                leprechaunScript = leprechaunObject.AddComponent<FarDarrig>();
                Global.lepGOlepScript.Add(leprechaunObject, leprechaunScript.ToString());
                leprechaunScript.GetComponent<FarDarrig>().SetFarDarrig(playerStartPosition, controllerNumber, chosenCharacter, gameObject);
                gameObject.GetComponent<BoxCollider2D>().size = leprechaunScript.GetComponent<FarDarrig>().bodyCheck.GetComponent<BoxCollider2D>().size;
                gameObject.GetComponent<BoxCollider2D>().center = leprechaunScript.GetComponent<FarDarrig>().bodyCheck.GetComponent<BoxCollider2D>().center;
                break;
//.........这里部分代码省略.........
开发者ID:thomvandevin,项目名称:thomvandevin_pintsandpunches,代码行数:101,代码来源:Player.cs

示例11: ResetPlayer

    public void ResetPlayer(GameObject deadLeprechaun)
    {
        Vector3 deadLepPosition = deadLeprechaun.transform.position;
        Destroy(deadLeprechaun);

        GameObject RespawnAnimation = Instantiate(Resources.Load("Prefabs/Objects/HUD/Respawn_Animation"), transform.position, Quaternion.identity) as GameObject;
        RespawnAnimation.GetComponent<RespawnAnimation>().SetRespawnAnimation(gameObject);

        gameObject.transform.position = deadLepPosition;
        leprechaunObject = Instantiate(Resources.Load(loadCharacterString), transform.position, Quaternion.identity) as GameObject;

        leprechaunObject.transform.parent = gameObject.transform;
        switch (chosenCharacter)
        {
            case Character.LEPRECHAUN_01:
                leprechaunScript = leprechaunObject.AddComponent<Leprechaun>();
                Global.lepGOlepScript.Add(leprechaunObject, leprechaunScript.ToString());
                leprechaunScript.GetComponent<Leprechaun>().SetLeprechaun(deadLepPosition, controllerNumber, chosenCharacter, gameObject);
                break;
            case Character.LEPRECHAUN_USA:
                leprechaunScript = leprechaunObject.AddComponent<Leprechaun_USA>();
                Global.lepGOlepScript.Add(leprechaunObject, leprechaunScript.ToString());
                leprechaunScript.GetComponent<Leprechaun_USA>().SetLeprechaun_USA(deadLepPosition, controllerNumber, chosenCharacter, gameObject);
                break;
            case Character.CLUIRICHAUN:
                leprechaunScript = leprechaunObject.AddComponent<Cluirichaun>();
                Global.lepGOlepScript.Add(leprechaunObject, leprechaunScript.ToString());
                leprechaunScript.GetComponent<Cluirichaun>().SetCluirichaun(deadLepPosition, controllerNumber, chosenCharacter, gameObject);
                break;
            case Character.FAR_DARRIG:
                leprechaunScript = leprechaunObject.AddComponent<FarDarrig>();
                Global.lepGOlepScript.Add(leprechaunObject, leprechaunScript.ToString());
                leprechaunScript.GetComponent<FarDarrig>().SetFarDarrig(deadLepPosition, controllerNumber, chosenCharacter, gameObject);
                break;
            case Character.FAIRY:
                leprechaunScript = leprechaunObject.AddComponent<Fairy>();
                Global.lepGOlepScript.Add(leprechaunObject, leprechaunScript.ToString());
                leprechaunScript.GetComponent<Fairy>().SetFairy(deadLepPosition, controllerNumber, chosenCharacter, gameObject);
                break;
            default:
                break;
        }
        Global.leprechauns.Add(leprechaunObject);

    }
开发者ID:thomvandevin,项目名称:thomvandevin_pintsandpunches,代码行数:45,代码来源:Player.cs


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