• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Cloud类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ShouldCreateMatchWithMinimumArgs

 public void ShouldCreateMatchWithMinimumArgs(Cloud cloud)
 {
     Login(cloud, gamer => {
         gamer.Matches.Create(maxPlayers: 2)
         .CompleteTestIfSuccessful();
     });
 }
开发者ID:StudioJD,项目名称:unity-sdk,代码行数:7,代码来源:MatchTests.cs


示例2: ShouldListScoreOfFriends

 public void ShouldListScoreOfFriends(Cloud cloud)
 {
     // Create 2 users
     Login2NewUsers(cloud, (gamer1, gamer2) => {
         // Post 1 score each
         string board = RandomBoardName();
         gamer1.Scores.Post(1000, board, ScoreOrder.HighToLow, "TestGamer1", false)
         .ExpectSuccess(dummy => gamer2.Scores.Post(1500, board, ScoreOrder.HighToLow, "TestGamer2", false))
         // We need to wait a bit else the results may be misleading
         .ExpectSuccess(dummy => Wait<object>(1000))
         // Ok so now the two friends are not friends, so the scores returned should not include the other
         .ExpectSuccess(dummy => gamer1.Scores.ListFriendScores(board))
         .ExpectSuccess(scores => {
             Assert(scores.Count == 1, "Should have one score only");
             Assert(scores[0].GamerInfo.GamerId == gamer1.GamerId, "Should contain my score");
             // So let's become friends!
             return gamer2.Community.AddFriend(gamer1.GamerId);
         })
         // And try again fetching scores
         .ExpectSuccess(dummy => Wait<object>(1000))
         .ExpectSuccess(friendResult => gamer1.Scores.ListFriendScores(board))
         .ExpectSuccess(scoresWhenFriend => {
             Assert(scoresWhenFriend.Count == 2, "Should have two scores only");
             Assert(scoresWhenFriend[1].Rank == 2, "Second score should have rank 2");
             CompleteTest();
         });
     });
 }
开发者ID:StudioJD,项目名称:unity-sdk,代码行数:28,代码来源:ScoreTests.cs


示例3: ShouldCreateMatch

 public void ShouldCreateMatch(Cloud cloud)
 {
     string matchDesc = "Test match";
     Login(cloud, gamer => {
         gamer.Matches.Create(
             description: matchDesc,
             maxPlayers: 2,
             customProperties: Bundle.CreateObject("test", "value"),
             shoe: Bundle.CreateArray(1, 2, 3))
         .ExpectSuccess(match => {
             Assert(match.Creator.GamerId == gamer.GamerId, "Match creator not set properly");
             Assert(match.CustomProperties["test"] == "value", "Missing custom property");
             Assert(match.Description == matchDesc, "Invalid match description");
             Assert(match.Moves.Count == 0, "Should not have any move at first");
             Assert(match.GlobalState.AsDictionary().Count == 0, "Global state should be empty initially");
             Assert(match.LastEventId != null, "Last event should not be null");
             Assert(match.MatchId != null, "Match ID shouldn't be null");
             Assert(match.MaxPlayers == 2, "Should have two players");
             Assert(match.Players.Count == 1, "Should contain only one player");
             Assert(match.Players[0].GamerId == gamer.GamerId, "Should contain me as player");
             Assert(match.Seed != 0, "A 31-bit seed should be provided");
             Assert(match.Shoe.AsArray().Count == 0, "The shoe shouldn't be available until the match is finished");
             Assert(match.Status == MatchStatus.Running, "The match status is invalid");
             CompleteTest();
         });
     });
 }
开发者ID:StudioJD,项目名称:unity-sdk,代码行数:27,代码来源:MatchTests.cs


示例4: Render

 public virtual void Render(Cloud cloud, Graphics g)
 {
     foreach (var block in cloud)
     {
         DrawWord(block.Data, g, block.LeftTop);
     }
 }
开发者ID:RawRCoder,项目名称:03-design-hw,代码行数:7,代码来源:WordRenderer.cs


示例5: Start

	// Use this for initialization
	void Start () {
		var cotc = FindObjectOfType<CotcGameObject> ();
		if (cotc == null) {
			throw new SystemException ("No Clan of the Cloud SDK object found on the scene");
		}

		// Log unhandled exceptions (.Done block without .Catch -- not called if there is any .Then)
		Promise.UnhandledException += (object sender, ExceptionEventArgs e) => {
			Debug.LogError("Unhandled exception: " + e.Exception.ToString());
		};
//		Promise.Debug_OutputAllExceptions = true;
//		PlayerPrefs.DeleteAll();

		// Initiate getting the main Cloud object
		cotc.GetCloud().Done(cloud => {
			Cloud = cloud;
			// Retry failed HTTP requests once after 1 sec, then 5, finally abort.
			Cloud.HttpRequestFailedHandler = (HttpRequestFailedEventArgs e) => {
				int count = (int?) e.UserData ?? 0;
				if (count == 0)      e.RetryIn(1000);
				else if (count == 1) e.RetryIn(5000);
				else                 e.Abort();
				e.UserData = ++count;
			};
			Debug.Log("Setup done");
//			PostSampleScoresForTesting();
			InitCloud();
		});

		Debug.Assert(ConfirmationDialog != null);
	}
开发者ID:xtralifecloud,项目名称:RocketMouse-Social,代码行数:32,代码来源:Social.cs


示例6: ShouldBeUsableToSearchForMatches

    public void ShouldBeUsableToSearchForMatches(Cloud cloud)
    {
        Login2NewUsers(cloud, (gamer1, gamer2) => {
            string queryStr = "public:true AND owner_id:" + gamer1.GamerId;
            Match[] matches = new Match[2];

            gamer1.Matches.Create(maxPlayers: 2)
            .Then(match1 => {
                Bundle matchProp = Bundle.CreateObject("public", true, "owner_id", gamer1.GamerId);
                matches[0] = match1;
                // Index the match
                return cloud.Index("matches").IndexObject(match1.MatchId, matchProp, Bundle.Empty);
            })
            .Then(indexResult => {
                // Create another match
                return gamer1.Matches.Create(maxPlayers: 2);
            })
            .Then(match2 => {
                // Index it
                matches[1] = match2;
                return cloud.Index("matches").IndexObject(match2.MatchId, Bundle.CreateObject("public", false), Bundle.Empty);
            })
            .Then(indexResult2 => {
                // Check that we can find match1 by looking for public matches
                return cloud.Index("matches").Search(queryStr);
            })
            .Then(found => {
                Assert(found.Hits.Count == 1, "Should find one match");
                Assert(found.Hits[0].ObjectId == matches[0].MatchId, "Should find one match");
            })
            .CompleteTestIfSuccessful();
        });
    }
开发者ID:StudioJD,项目名称:unity-sdk,代码行数:33,代码来源:IndexTests.cs


示例7: Connect

        public ProviderResponse<Cloud> Connect(Cloud cloud)
        {
            ProviderResponse<Cloud> response = new ProviderResponse<Cloud>();
            Cloud local = cloud.DeepCopy();
            IVcapClient client = new VcapClient(local);

            try
            {
                VcapClientResult result = client.Login();
                if (!result.Success)
                    throw new Exception(result.Message);
                local.AccessToken = client.CurrentToken;
                var applications = client.GetApplications();
                var provisionedServices = client.GetProvisionedServices();
                var availableServices = client.GetSystemServices();
                local.Applications.Synchronize(new SafeObservableCollection<Application>(applications), new ApplicationEqualityComparer());
                local.Services.Synchronize(new SafeObservableCollection<ProvisionedService>(provisionedServices), new ProvisionedServiceEqualityComparer());
                local.AvailableServices.Synchronize(new SafeObservableCollection<SystemService>(availableServices), new SystemServiceEqualityComparer());
                foreach (Application app in local.Applications)
                {
                    var instances = GetInstances(local, app);
                    if (instances.Response != null)
                        app.InstanceCollection.Synchronize(new SafeObservableCollection<Instance>(instances.Response), new InstanceEqualityComparer());
                }
                response.Response = local;
            }
            catch (Exception ex)
            {
                response.Message = ex.Message;
            }
            return response;
        }
开发者ID:ademar,项目名称:ironfoundry,代码行数:32,代码来源:CloudFoundryProvider.cs


示例8: ShouldHavePaginationInTxHistory

 public void ShouldHavePaginationInTxHistory(Cloud cloud)
 {
     LoginNewUser(cloud, gamer => {
         // Run 3 transactions serially
         gamer.Transactions.Post(Bundle.CreateObject("gold", 1))
         .ExpectSuccess(dummy => gamer.Transactions.Post(Bundle.CreateObject("gold", 2, "silver", 10)))
         .ExpectSuccess(dummy => gamer.Transactions.Post(Bundle.CreateObject("gold", 3)))
         // All transactions have been executed. Default to page 1.
         .ExpectSuccess(dummy => gamer.Transactions.History(limit: 2))
         .ExpectSuccess(tx => {
             // Even though there are three, only two results should be returned
             Assert(tx.Count == 2, "Expected two entries in history");
             // Then fetch the next page
             Assert(!tx.HasPrevious, "Should not have previous page");
             Assert(tx.HasNext, "Should have next page");
             return tx.FetchNext();
         })
         .ExpectSuccess(tx => {
             Assert(tx.Offset == 2, "Expected offset: 2");
             Assert(tx.Count == 1, "Expected one value at page 2");
             Assert(tx.HasPrevious, "Should have previous page");
             Assert(!tx.HasNext, "Should not have next page");
             return tx.FetchPrevious();
         })
         .ExpectSuccess(tx => {
             Assert(tx.Count == 2, "Expected two entries in history");
             Assert(!tx.HasPrevious, "Should not have previous page");
             Assert(tx.HasNext, "Should have next page");
             CompleteTest();
         });
     });
 }
开发者ID:StudioJD,项目名称:unity-sdk,代码行数:32,代码来源:TransactionTests.cs


示例9: ShouldAddFriend

    public void ShouldAddFriend(Cloud cloud)
    {
        // Use two test accounts
        Login2NewUsers(cloud, (gamer1, gamer2) => {
            // Expects friend status change event
            Promise restOfTheTestCompleted = new Promise();
            gamer1.StartEventLoop();
            gamer1.Community.OnFriendStatusChange += (FriendStatusChangeEvent e) => {
                Assert(e.FriendId == gamer2.GamerId, "Should come from P2");
                Assert(e.NewStatus == FriendRelationshipStatus.Add, "Should have added me");
                restOfTheTestCompleted.Done(CompleteTest);
            };

            // Add gamer1 as a friend of gamer2
            gamer2.Community.AddFriend(gamer1.GamerId)
            .ExpectSuccess(addResult => {
                // Then list the friends of gamer1, gamer2 should be in it
                return gamer1.Community.ListFriends();
            })
            .ExpectSuccess(friends => {
                Assert(friends.Count == 1, "Expects one friend");
                Assert(friends[0].GamerId == gamer2.GamerId, "Wrong friend ID");
                restOfTheTestCompleted.Resolve();
            });
        });
    }
开发者ID:StudioJD,项目名称:unity-sdk,代码行数:26,代码来源:CommunityTests.cs


示例10: InitializeData

 protected override void InitializeData()
 {
     Messenger.Default.Send(new NotificationMessageAction<Cloud>(Messages.SetChangePasswordData, c => {
         this.EMail = c.Email;
         this.cloud = c;
     }));
 }
开发者ID:ademar,项目名称:ironfoundry,代码行数:7,代码来源:ChangePasswordViewModel.cs


示例11: ShouldAssociateGodfather

    public void ShouldAssociateGodfather(Cloud cloud)
    {
        Login2NewUsers(cloud, (gamer1, gamer2) => {
            // Expects godchild event
            Promise restOfTheTestCompleted = new Promise();
            gamer1.StartEventLoop();
            gamer1.Godfather.OnGotGodchild += (GotGodchildEvent e) => {
                Assert(e.Gamer.GamerId == gamer2.GamerId, "Should come from player2");
                Assert((object)e.Reward == (object)Bundle.Empty, "No reward should be associated");
                restOfTheTestCompleted.Done(CompleteTest);
            };

            // P1 generates a code and associates P2 with it
            gamer1.Godfather.GenerateCode()
            // Use code
            .ExpectSuccess(genCode => gamer2.Godfather.UseCode(genCode))
            .ExpectSuccess(dummy => gamer2.Godfather.GetGodfather())
            .ExpectSuccess(result => {
                Assert(result.GamerId == gamer1.GamerId, "P1 should be godfather");
                Assert(result.AsBundle().Root.Has("godfather"), "Underlying structure should be accessible");
                return gamer1.Godfather.GetGodchildren();
            })
            .ExpectSuccess(result => {
                Assert(result.Count == 1, "Should have only one godchildren");
                Assert(result[0].GamerId == gamer2.GamerId, "P2 should be godchildren");
                restOfTheTestCompleted.Resolve();
            });
        });
    }
开发者ID:StudioJD,项目名称:unity-sdk,代码行数:29,代码来源:GodfatherTests.cs


示例12: ShouldRunGameBatch

 public void ShouldRunGameBatch(Cloud cloud)
 {
     cloud.Game.Batches.Run("test", Bundle.CreateObject("value", 3))
     .ExpectSuccess(batchResult => {
         Assert(batchResult["value"] == 6, "Result invalid (expected 3 x 2 = 6)");
         CompleteTest();
     });
 }
开发者ID:StudioJD,项目名称:unity-sdk,代码行数:8,代码来源:GameTests.cs


示例13: InitializeData

 protected override void InitializeData()
 {
     Messenger.Default.Send(new NotificationMessageAction<Cloud>(Messages.SetCreateServiceData,
         (cloud) =>
         {
             this.cloud = cloud;
             this.SystemServices.Synchronize(cloud.AvailableServices, new SystemServiceEqualityComparer());
         }));
 }
开发者ID:ademar,项目名称:ironfoundry,代码行数:9,代码来源:ProvisionedServiceViewModel.cs


示例14: InitializeData

 protected override void InitializeData()
 {
     Messenger.Default.Send(new NotificationMessageAction<Cloud>(Messages.SetRegisterAccountData,
         (cloud) =>
         {
             this.cloud = cloud;
             this.EMail = cloud.Email;
             this.NewPassword = cloud.Password;
         }));
 }
开发者ID:ademar,项目名称:ironfoundry,代码行数:10,代码来源:RegisterAccountViewModel.cs


示例15: ShouldRunGamerBatch

 public void ShouldRunGamerBatch(Cloud cloud)
 {
     Login(cloud, gamer => {
         gamer.Batches.Run("testGamer", Bundle.CreateObject("prefix", "Hello "))
         .ExpectSuccess(batchResult => {
             Assert(batchResult["message"] == "Hello [email protected]", "Returned value invalid (" + batchResult["message"] + ", check hook on server");
             CompleteTest();
         });
     });
 }
开发者ID:StudioJD,项目名称:unity-sdk,代码行数:10,代码来源:GamerTests.cs


示例16: ShouldNotReadInexistingKey

 public void ShouldNotReadInexistingKey(Cloud cloud)
 {
     cloud.LoginAnonymously().ExpectSuccess(gamer => {
         gamer.GamerVfs.GetKey("nonexistingkey")
         .ExpectFailure(getRes => {
             Assert(getRes.HttpStatusCode == 404, "Wrong error code (404)");
             Assert(getRes.ServerData["name"] == "KeyNotFound", "Wrong error message");
             CompleteTest();
         });
     });
 }
开发者ID:StudioJD,项目名称:unity-sdk,代码行数:11,代码来源:VfsTests.cs


示例17: AddCloudViewModel

 public AddCloudViewModel()
     : base(Messages.AddCloudDialogResult)
 {
     Cloud = new Cloud();
     dispatcher = Dispatcher.CurrentDispatcher;
     ValidateAccountCommand = new RelayCommand(ValidateAccount, CanValidate);
     RegisterAccountCommand = new RelayCommand(RegisterAccount, CanRegister);
     ManageCloudUrlsCommand = new RelayCommand(ManageCloudUrls);
     cloudUrls = provider.CloudUrls;
     SelectedCloudUrl = cloudUrls.SingleOrDefault((i) => i.IsDefault);
 }
开发者ID:hellojais,项目名称:ironfoundry,代码行数:11,代码来源:AddCloudViewModel.cs


示例18: TestInitialize

 public void TestInitialize()
 {
     factories = Substitute.For<Factories>();
     providerFactory = Substitute.For<CloudProviderFactory>();
     provider = Substitute.For<CloudProvider>();
     providerFactory.Create().Returns(provider);
     exportAndImport = Substitute.For<ExportAndImport>();
     settings = new Settings { CloudToken = "foo" };
     factories.Settings.Returns(settings);
     sut = new CloudImpl(providerFactory, factories, exportAndImport);
 }
开发者ID:PawelStroinski,项目名称:Diettr-GPL,代码行数:11,代码来源:CloudTests.cs


示例19: ShouldReturnProperOutline

 public void ShouldReturnProperOutline(Cloud cloud)
 {
     Login(cloud, gamer => {
         gamer.Profile.Outline()
         .ExpectSuccess(outline => {
             Assert(outline.Network == gamer.Network, "Expected same network");
             Assert(outline.NetworkId == gamer.NetworkId, "Expected same network ID");
             Assert(outline["games"].Type == Bundle.DataType.Array, "Expected games array");
             CompleteTest();
         });
     });
 }
开发者ID:StudioJD,项目名称:unity-sdk,代码行数:12,代码来源:GamerTests.cs


示例20: ShouldChangePassword

 public void ShouldChangePassword(Cloud cloud)
 {
     cloud.Login(
         network: LoginNetwork.Email,
         networkId: RandomEmailAddress(),
         networkSecret: "Password123")
     .Then(gamer => gamer.Account.ChangePassword("Password124"))
     .Then(pswResult => {
         Assert(pswResult, "Change password failed");
     })
     .CompleteTestIfSuccessful();
 }
开发者ID:StudioJD,项目名称:unity-sdk,代码行数:12,代码来源:CloudTests.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CloudMediaContext类代码示例发布时间:2022-05-24
下一篇:
C# Closure类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap