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


C# UnityAction.Invoke方法代码示例

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


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

示例1: Display

    public void Display(string text, UnityAction okAction, UnityAction cancelAction)
    {
        gameObject.SetActive(true);
        DisplayText.text = text;

        ValidButton.transform.GetChild(0).GetComponent<Text>().text = "Replay";
        ValidButton.onClick.RemoveAllListeners();
        ValidButton.onClick.AddListener(delegate { ValidButton.transform.GetChild(0).GetComponent<Text>().text = "Waiting..."; okAction.Invoke(); });

        CancelButton.onClick.RemoveAllListeners();
        CancelButton.onClick.AddListener(cancelAction);
    }
开发者ID:TobiahZ,项目名称:UnityNetwork,代码行数:12,代码来源:GameEndPanel.cs

示例2: DeletePlayerInternal

	private IEnumerator DeletePlayerInternal(string playerName,UnityAction callback)
	{
		WWWForm newForm = new WWWForm();
		newForm.AddField("name", playerName);
		
		WWW w = new WWW(settings.serverAddress + "/" + settings.deletePlayer , newForm);
		
		while (!w.isDone)
		{
			yield return new WaitForEndOfFrame();
		}
		
		if (w.error != null)
		{
			Debug.LogError(w.error);
		}
		if (callback != null) {
			callback.Invoke();		
		}
		Execute("OnDeletePlayer",new PlayerEventData());
	}
开发者ID:AlexGam,项目名称:TowerIsland,代码行数:21,代码来源:PlayerSystem.cs

示例3: DeletePlayerInternalPrefs

	public void DeletePlayerInternalPrefs(string playerName,UnityAction callback){
		string res = PlayerPrefs.GetString (playersKey);
		List<string> players = new List<string> ();
		string[] arr = res.Split('/');
		if (arr.Length > 0)
		{
			for (int i = 0; i < arr.Length; i++)
			{
				string[] data = arr[i].Split(',');
				if(data.Length > 2){
					string mName = data[0];
					string custom = data[1];
					string level = data[2];
					if(mName != playerName){
						players.Add(mName+","+custom+","+level);
					}
				}
			}
		}
		string allPlayers = string.Empty;
		foreach (string player in players) {
			allPlayers+=player+"/";
		}
		PlayerPrefs.SetString (playersKey, allPlayers);
		if (callback != null) {
			callback.Invoke();		
		}
		Execute("OnDeletePlayer",new PlayerEventData());
	}
开发者ID:AlexGam,项目名称:TowerIsland,代码行数:29,代码来源:PlayerSystem.cs

示例4: CreatePlayerInternalPrefs

	private void CreatePlayerInternalPrefs(string playerName, string custom, UnityAction<bool> callback){
		string newPlayer=playerName+","+custom+",1";

		string allPlayers = PlayerPrefs.GetString (playersKey);
		string[] arr = allPlayers.Split('/');
		if (arr.Length > 0)
		{
			for (int i = 0; i < arr.Length; i++)
			{
				string[] data = arr[i].Split(',');
				if(data.Length > 2){
					string mName=data[0];
					if(playerName == mName){
						if(callback != null){
							callback.Invoke(false);
						}
						return;
					}
				}
			}
		}
		if (callback != null) {
			callback.Invoke (true);
		}
		PlayerPrefs.SetString (playersKey,allPlayers + "/" + newPlayer);
		PlayerEventData eventData = new PlayerEventData ();
		eventData.playerName = playerName;
		eventData.level = 1;
		eventData.custom = custom;
		Execute("OnCreatePlayer",eventData);
	}
开发者ID:AlexGam,项目名称:TowerIsland,代码行数:31,代码来源:PlayerSystem.cs

示例5: CreateAccountInternal

	private IEnumerator CreateAccountInternal (string username, string password, string email, UnityAction<bool> callback)
	{
		if (settings == null) {
			yield break;		
		}
		WWWForm newForm = new WWWForm ();
		newForm.AddField ("name", username);
		newForm.AddField ("password", password);
		newForm.AddField ("email", email);

        WWW w = new WWW(settings.serverAddress + "/" + settings.createAccount, newForm);
		
		while (!w.isDone) {
			yield return new WaitForEndOfFrame();
		}
		
		if (w.error != null) {
			Debug.LogError (w.error);
		}
		
		bool res = w.text.Trim ().Equals("true");
		if (callback != null) {
			callback.Invoke (res);
		}
		AccountEventData eventData = new AccountEventData ();
        eventData.serverAdress = settings.serverAddress;
		User user = new User (username);
		user.password = password;
		eventData.user = user;
		eventData.result = res;
		Execute("OnCreateAccount",eventData);
	}
开发者ID:AlexGam,项目名称:TowerIsland,代码行数:32,代码来源:AccountSystem.cs

示例6: forEachHandle

    public static void forEachHandle(string path,string matchExt,UnityAction<string> handle)
    {
        string[] names = Directory.GetFiles(path);
        string[] dirs = Directory.GetDirectories(path);
        foreach (string filename in names)
        {
            string[] name_splits = filename.Split('.');
            string ext = name_splits[name_splits.Length-1];
            if (ext.Equals(matchExt))
            {
                handle.Invoke(filename);
            }
        }

        foreach (string dir in dirs)
        {
            forEachHandle(dir, matchExt, handle);
        }
    }
开发者ID:Ribosome2,项目名称:uLui,代码行数:19,代码来源:ExportAssetBundles.cs

示例7: CreatePlayerInternal

	private IEnumerator CreatePlayerInternal(string username,string playerName, string custom, UnityAction<bool> callback){
		WWWForm newForm = new WWWForm ();
		newForm.AddField ("account", username);
		newForm.AddField ("name", playerName);
		newForm.AddField ("custom", custom);
		newForm.AddField ("level", 1);
		
		WWW w = new WWW (settings.serverAddress + "/"+settings.createPlayer, newForm);
		
		while (!w.isDone) {
			yield return new WaitForEndOfFrame();
		}
		
		if (w.error != null) {
			Debug.LogError (w.error);
		}
		
		bool res = w.text.Trim ().Equals("true");
		if (callback != null) {
			callback.Invoke(res);		
		}
		PlayerEventData eventData = new PlayerEventData ();
		eventData.playerName = playerName;
		eventData.level = 1;
		eventData.custom = custom;
		Execute("OnCreatePlayer",eventData);
	}
开发者ID:AlexGam,项目名称:TowerIsland,代码行数:27,代码来源:PlayerSystem.cs

示例8: LoadPlayersInternal

	private IEnumerator LoadPlayersInternal(string username, UnityAction<PlayerEventData> callback)
	{
		WWWForm newForm = new WWWForm();
		newForm.AddField("account", username);
		
		WWW w = new WWW(settings.serverAddress + "/"+settings.loadPlayers, newForm);
		
		while (!w.isDone)
		{
			yield return new WaitForEndOfFrame();
		}
		
		if (w.error != null)
		{
			Debug.LogError(w.error);
		}
		
		string res = w.text.Trim();
        Debug.Log(res);
		string[] arr = res.Split('/');
		if (arr.Length > 0)
		{
			for (int i = 0; i < arr.Length; i++)
			{
				string[] data = arr[i].Split(',');
				if(data.Length > 2){
					PlayerEventData eventData = new PlayerEventData ();
					eventData.playerName = data[0];
					Debug.Log(data[2]);
					eventData.level = int.Parse(data[2]);
					eventData.custom = data[1];
					Execute("OnLoadPlayer",eventData);
					if (callback != null) {
						callback.Invoke(eventData);
					}
				}
			}
		}
	}
开发者ID:AlexGam,项目名称:TowerIsland,代码行数:39,代码来源:PlayerSystem.cs

示例9: LoadPlayersInternalPrefs

	private void LoadPlayersInternalPrefs(UnityAction<PlayerEventData> callback){
		string res = PlayerPrefs.GetString (playersKey);
		string[] arr = res.Split('/');
		if (arr.Length > 0)
		{
			for (int i = 0; i < arr.Length; i++)
			{
				string[] data = arr[i].Split(',');
				if(data.Length > 2){
					PlayerEventData eventData = new PlayerEventData ();
					eventData.playerName = data[0];
					Debug.Log(data[2]);
					eventData.level = int.Parse(data[2]);
					eventData.custom = data[1];
					Execute("OnLoadPlayer",eventData);
					if (callback != null) {
						callback.Invoke(eventData);
					}
				}
			}
		}
	}
开发者ID:AlexGam,项目名称:TowerIsland,代码行数:22,代码来源:PlayerSystem.cs

示例10: parseRichElemString

        public void parseRichElemString(string content, UnityAction<string, Dictionary<string, string>> handleFunc)
        {
            List<string> elemStrs = new List<string>();

            int startIndex = 0;
            elemStrs = executeParseRichElem(elemStrs, content, startIndex);

            int len = elemStrs.Count;
            for (int i = 0; i < len; i++)
            {
                string flag = elemStrs[i].Substring(0, elemStrs[i].IndexOf(" "));
                string paramStr = elemStrs[i].Substring(elemStrs[i].IndexOf(" ") + 1);
                string[] paramArr = SaftSplite(paramStr,' ');

                Dictionary<string, string> param = new Dictionary<string, string>();
                int paramArrLen = paramArr.Length;
                for (int j = 0; j < paramArrLen; j++)
                {
                    string[] paramObj = SaftSplite(paramArr[j], '=');
                    string left = paramObj[0].Trim();
                    string right = paramObj[1].Trim();

                    if (right.EndsWith("\"") && right.StartsWith("\""))
                    {
                        param.Add(left, right.Trim('"'));
                    }
                    else
                    {
                        param.Add(left, right);
                    }
                }
                handleFunc.Invoke(flag, param);
            }
        }
开发者ID:xmkp,项目名称:uLui,代码行数:34,代码来源:LRichText.cs

示例11: parseRichDefaultString

 public void parseRichDefaultString(string content, UnityAction<string, Dictionary<string, string>> specHandleFunc=null)
 {
     parseRichElemString(content, (flag, param) =>
     {
         if (flag == "lab")
         {
             this.insertElement(
                 param.ContainsKey("txt") ? param["txt"] : "",
                 LUtil.StringToColor(param.ContainsKey("color") ? param["color"] : defaultLabColor),
                 param.ContainsKey("size") ? System.Convert.ToInt32(param["size"]) : defaultLabSize,
                 param.ContainsKey("isUnderLine") ? System.Convert.ToBoolean(param["isUnderLine"]) : false,
                 param.ContainsKey("isOutLine") ? System.Convert.ToBoolean(param["isOutLine"]) : false,
                 LUtil.StringToColor(param.ContainsKey("outLineColor") ? param["outLineColor"] : defaultLabColor),
                 param.ContainsKey("data") ? param["data"] : ""
                 );
         }else if(flag == "img")
         {
             this.insertElement(
                  param.ContainsKey("path") ? param["path"] : "",
                  param.ContainsKey("data") ? param["data"] : "");
         }else if(flag == "anim")
         {
             this.insertElement(param["path"],
                  param.ContainsKey("fps") ? System.Convert.ToSingle(param["fps"]) : 15f,
                  param.ContainsKey("data") ? param["data"] : "");
         }else if(flag == "newline")
         {
             this.insertElement(1);
         }
         else
         {
             if(specHandleFunc != null) specHandleFunc.Invoke(flag, param);
         }
     });
     this.reloadData();
 }
开发者ID:xmkp,项目名称:uLui,代码行数:36,代码来源:LRichText.cs

示例12: Open

        /// <summary>
        /// Open the MessageBox
        /// </summary>
        /// <param name="title">Title.</param>
        /// <param name="text">Text.</param>
        /// <param name="icon">Icon.</param>
        /// <param name="result">Result.</param>
        /// <param name="buttons">Buttons.</param>
        public virtual void Open(string title, string text, Sprite icon, UnityAction<string> result, params string[] buttons)
        {
            for (int i=0; i<buttonCache.Count; i++) {
                buttonCache[i].gameObject.SetActive(false);
            }
            if (!string.IsNullOrEmpty (title)) {
                this.title.text = title;
                this.title.gameObject.SetActive (true);
            } else {
                this.title.gameObject.SetActive(false);
            }

            this.text.text = text;

            if(icon != null){
                this.icon.sprite = icon;
                this.icon.transform.parent.gameObject.SetActive(true);
            }else{
                this.icon.transform.parent.gameObject.SetActive(false);
            }
            button.gameObject.SetActive (false);
            for (int i=0; i<buttons.Length; i++) {
                string caption=buttons[i];
                AddButton(caption).onClick.AddListener(delegate() {
                    result.Invoke(caption);
                    Close();
                });
            }
            base.Open ();
        }
开发者ID:gloowa,项目名称:mstest,代码行数:38,代码来源:MessageBox.cs


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