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


C# Friend.SetFriend方法代码示例

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


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

示例1: OnReceiveGames

	void OnReceiveGames(string error, IJSonObject data)
	{
		if(notInThisPanel) return;
		
		if(error != null) Debug.Log(error);
		else 
		{
			int oldYourTurnNumber = Flow.yourTurnGames;
			int oldTheirTurnNumber = Flow.theirTurnGames;
			
			Debug.Log(data);
			
			for(int i = 0 ; i < data["games"].Count ; i++)
			{
				if(!data["games"][i]["lastUpdate"].IsNull && Flow.lastUpdate < data["games"][i]["lastUpdate"].DateTimeValue)
				{
					Flow.lastUpdate = data["games"][i]["lastUpdate"].DateTimeValue;
				}
				
				string[] scores = new string[Flow.ROUNDS_PER_TURN];
				string[] times = new string[Flow.ROUNDS_PER_TURN];
				string[] pastMyScores = new string[Flow.ROUNDS_PER_TURN];
				string[] pastMyTimes = new string[Flow.ROUNDS_PER_TURN];
				string[] pastTheirScores = new string[Flow.ROUNDS_PER_TURN];
				string[] pastTheirTimes = new string[Flow.ROUNDS_PER_TURN];
				
				string faceID = "";
				int lastTurnID = -1;
				int tempWorldID = -1;
				string tempWorldName = "";
				string tempPastWorldName = "";
				
				List<Round> tempRoundList = new List<Round>();
				List<Round> tempPastMyRoundList = new List<Round>();
				List<Round> tempPastTheirRoundList = new List<Round>();
				
				string[] separator = {"|[email protected]@$|"};
				
				if(data["games"][i]["turnStatus"].StringValue != "waitingChoice" && data["games"][i]["whoseMove"].StringValue != "their")
				{
					Debug.Log("adicionei rounds atuais");
					if(!data["games"][i]["scores"].IsNull) scores = data["games"][i]["scores"].StringValue.Split(separator,StringSplitOptions.None);
					if(!data["games"][i]["times"].IsNull) times = data["games"][i]["times"].StringValue.Split(separator,StringSplitOptions.None);
					
					for(int j = 0 ; j < Flow.ROUNDS_PER_TURN ; j++)
					{
						tempRoundList.Add (new Round (-1, data["games"][i]["turn"].Int32Value, data["games"][i]["friendID"].Int32Value, times[j].ToFloat(),
							scores[j].ToInt32()));
					}
				}
				if(!data["games"][i]["lastTurn"].IsNull) 
				{
					Debug.Log("adicionei os rounds passados");
					pastMyScores = data["games"][i]["myPastScores"].StringValue.Split(separator,StringSplitOptions.None);
					pastMyTimes = data["games"][i]["myPastTimes"].StringValue.Split(separator,StringSplitOptions.None);
					pastTheirScores = data["games"][i]["theirPastScores"].StringValue.Split(separator,StringSplitOptions.None);
					pastTheirTimes = data["games"][i]["theirPastTimes"].StringValue.Split(separator,StringSplitOptions.None);
					
					for(int k = 0 ; k < pastMyScores.Length ; k++)
					{
						tempPastMyRoundList.Add(new Round(-1,-1,-1,pastMyTimes[k].ToFloat(),int.Parse(pastMyScores[k])));
						tempPastTheirRoundList.Add(new Round(-1,-1,-1,pastTheirTimes[k].ToFloat(),int.Parse(pastTheirScores[k])));
					}
				}
					
				if(!data["games"][i]["facebookID"].IsNull) faceID = data["games"][i]["facebookID"].StringValue;
				if(!data["games"][i]["lastTurn"].IsNull) lastTurnID = data["games"][i]["lastTurn"].Int32Value;
				if(!data["games"][i]["world"].IsNull) tempWorldID = data["games"][i]["world"].Int32Value;
				if(!data["games"][i]["worldName"].IsNull) tempWorldName = data["games"][i]["worldName"].StringValue;
				if(!data["games"][i]["pastWorldName"].IsNull) tempPastWorldName = data["games"][i]["pastWorldName"].StringValue;
				
				Debug.Log("nome do cara "+data["games"][i]["username"].StringValue);
				
				bool foundGame = false;
				
				Friend tempFriend = new Friend();
				//GameObject tempObj = CreateGameContainer(data["games"][i]);
				
				//tempObj.transform.parent = GameObject.FindWithTag("RepoFLists").transform;
				
				//Game tempGame = tempObj.GetComponent<Game>();
				
				tempFriend = tempFriend.SetFriend(
					data["games"][i]["friendID"].StringValue,
					faceID,
					data["games"][i]["username"].StringValue,
					FriendshipStatus.NONE,
					data["games"][i]["hasApp"].StringValue.ToBool()
					//null,
					);
					
				Game tempGame =  new Game
				(
					data["games"][i]["gameID"].Int32Value,
					tempFriend,
					tempWorldID,
					tempWorldName,
					new List<Round>(),
					tempRoundList,
					data["games"][i]["turn"].Int32Value,
//.........这里部分代码省略.........
开发者ID:uptopgames,项目名称:baseproject,代码行数:101,代码来源:Multiplayer.cs

示例2: HandleInviteFriends

	private void HandleInviteFriends(string error, IJSonObject data)
	{
		Debug.Log("inviteNew: "+data);
		Flow.game_native.stopLoading();
		
		if (error != null)
		{
			Flow.game_native.showMessage("Error", error);
			return;
		}
		
		if (data == null)
		{
			Flow.game_native.showMessage("Error", GameJsonAuthConnection.DEFAULT_ERROR_MESSAGE);
			return;
		}
		
		bool allRight = true;
		
		int i = 0;
		foreach (IJSonObject valid in data.ArrayItems)
		{
			if(valid["id"].Int32Value == 0)
			{
				inviteFriendScroll.GetItem(i).transform.FindChild("Right Panel").gameObject.SetActive(true);
			}
			else
			{
				if(valid["valid"].BooleanValue)
				{
					inviteFriendScroll.GetItem(i).transform.FindChild("Right Panel").gameObject.SetActive(true);
					
					Friend tempFriend = new Friend();
					tempFriend = tempFriend.SetFriend(valid["id"].StringValue,valid["facebook_id"].StringValue,valid["name"].StringValue,FriendshipStatus.STANDALONE,valid["is_playing"].BooleanValue/*,null,loadingDialog,messageOkDialog,messageOkCancelDialog*/);
					
					bool found = false;
					for(int y = 0 ; y < newFriends.Count ; y++)
					{
						if(newFriends[y].id == valid["id"].StringValue) found = true;
					}
					
					if(!found) newFriends.Add(tempFriend);
				}
				else
				{
					inviteFriendScroll.GetItem(i).transform.FindChild("Wrong Panel").gameObject.SetActive(true);
					allRight = false;
				}
			}
			
			i++;
		}
		
		if (allRight)
		{
			Flow.game_native.showMessage("Success", "All your friends has been invited!");
			CloseInviteFriendsWindow();
						
			return;
		}
		
		Flow.game_native.showMessage("Error", "Some e-mails are not valid.");
	}
开发者ID:uptopgames,项目名称:Minesweeper,代码行数:63,代码来源:Invite.cs


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