public void OnCreatorButtonClicked()
        {
            CPDataEntityCollection dataEntityCollection = Service.Get <CPDataEntityCollection>();
            DataEntityHandle       handle = PlayerDataEntityFactory.CreateRemotePlayerEntity(dataEntityCollection, ItemData.creatorName);
            OpenPlayerCardCommand  openPlayerCardCommand = new OpenPlayerCardCommand(handle);

            openPlayerCardCommand.Execute();
        }
Esempio n. 2
0
    protected override IEnumerator setup()
    {
        GcsAccessTokenService gcsAccessTokenService = new GcsAccessTokenService(ConfigHelper.GetEnvironmentProperty <string>("GcsServiceAccountName"), new GcsP12AssetFileLoader(ConfigHelper.GetEnvironmentProperty <string>("GcsServiceAccountFile")));

        Service.Set((IGcsAccessTokenService)gcsAccessTokenService);
        string cdnUrl = ContentHelper.GetCdnUrl();
        string cpipeMappingFilename = ContentHelper.GetCpipeMappingFilename();
        CPipeManifestService cpipeManifestService = new CPipeManifestService(cdnUrl, cpipeMappingFilename, gcsAccessTokenService);

        Service.Set((ICPipeManifestService)cpipeManifestService);
        base.gameObject.AddComponent <KeyChainManager>();
        GameSettings gameSettings = new GameSettings();

        Service.Set(gameSettings);
        ContentManifest definition = ContentManifestUtility.FromDefinitionFile("Configuration/embedded_content_manifest");

        Service.Set(new Content(definition));
        Localizer localizer = Localizer.Instance;

        Service.Set(localizer);
        NullCPSwrveService cpSwrveService = new NullCPSwrveService();

        Service.Set((ICPSwrveService)cpSwrveService);
        NetworkServicesConfig networkConfig = NetworkController.GenerateNetworkServiceConfig(TestEnvironment);

        Service.Set((INetworkServicesManager) new NetworkServicesManager(this, networkConfig, offlineMode: false));
        CommerceService commerceService = new CommerceService();

        commerceService.Setup();
        Service.Set(commerceService);
        Service.Set(new MembershipService(null));
        ConnectionManager connectionManager = base.gameObject.AddComponent <ConnectionManager>();

        Service.Set(connectionManager);
        Service.Set(new SessionManager());
        Service.Set(new MixLoginCreateService());
        Service.Set((CPDataEntityCollection) new CPDataEntityCollectionImpl());
        LocalPlayerData localPlayerData = new LocalPlayerData
        {
            name         = "TestPlayer",
            tutorialData = new List <sbyte>()
        };
        PlayerId playerId = localPlayerData.id = new PlayerId
        {
            id   = "999999999999999",
            type = PlayerId.PlayerIdType.SESSION_ID
        };

        Service.Get <CPDataEntityCollection>().ResetLocalPlayerHandle();
        PlayerDataEntityFactory.AddLocalPlayerProfileDataComponents(Service.Get <CPDataEntityCollection>(), localPlayerData);
        LoginController loginController = new LoginController();

        Service.Set(loginController);
        loginController.SetNetworkConfig(networkConfig);
        IntegrationTestEx.FailIf(Service.Get <MixLoginCreateService>().NetworkConfigIsNotSet);
        yield return(null);
    }
 public void OnCreatorButtonClicked()
 {
     if (currentThemeData.mostPopularItem.HasValue)
     {
         CPDataEntityCollection dataEntityCollection = Service.Get <CPDataEntityCollection>();
         DataEntityHandle       handle = PlayerDataEntityFactory.CreateRemotePlayerEntity(dataEntityCollection, currentThemeData.mostPopularItem.Value.creatorName);
         OpenPlayerCardCommand  openPlayerCardCommand = new OpenPlayerCardCommand(handle);
         openPlayerCardCommand.Execute();
     }
 }
    public void OnReceivedOutgoingFriendInvitation(IOutgoingFriendInvitation outgoingFriendInvitation)
    {
        string text = outgoingFriendInvitation.Invitee.DisplayName.Text;

        if (!dataEntityCollection.TryFindEntity <DisplayNameData, string>(text, out DataEntityHandle dataEntityHandle))
        {
            dataEntityHandle = PlayerDataEntityFactory.CreateRemotePlayerEntity(dataEntityCollection, text);
        }
        addOutgoingInvitation(dataEntityHandle, outgoingFriendInvitation);
        onOutgoingInvitationsListUpdated();
    }
 public void OnOutgoingInvitationsListReady(List <IOutgoingFriendInvitation> outgoingFriendInvitations)
 {
     for (int i = 0; i < outgoingFriendInvitations.Count; i++)
     {
         string text = outgoingFriendInvitations[i].Invitee.DisplayName.Text;
         if (text == null || text.Length <= 0)
         {
             Log.LogError(this, "DisplayName is empty for a Mix friend, will not add friend to list.");
             continue;
         }
         DataEntityHandle handle = PlayerDataEntityFactory.CreateRemotePlayerEntity(dataEntityCollection, outgoingFriendInvitations[i].Invitee.DisplayName.Text);
         addOutgoingInvitation(handle, outgoingFriendInvitations[i]);
     }
 }
 public void OnFriendsListReady(List <IFriend> friends)
 {
     for (int i = 0; i < friends.Count; i++)
     {
         string text = friends[i].DisplayName.Text;
         if (text == null || text.Length <= 0)
         {
             Log.LogError(this, "DisplayName is empty for a Mix friend, will not add friend to list.");
             continue;
         }
         DataEntityHandle handle = PlayerDataEntityFactory.CreateRemotePlayerEntity(dataEntityCollection, friends[i].DisplayName.Text);
         addFriendStatusAndSwid(handle, friends[i]);
     }
 }
    private void addOtherPlayerIglooListing(IglooListItem iglooListItem)
    {
        DataEntityHandle handle = PlayerDataEntityFactory.CreateRemotePlayerEntity(dataEntityCollection, iglooListItem.ownerData.name);

        if (!dataEntityCollection.TryGetComponent(handle, out IglooListingData component))
        {
            component = dataEntityCollection.AddComponent <IglooListingData>(handle);
        }
        RoomPopulationScale roomPopulation = RoomPopulationScale.ZERO;

        if (iglooListItem.iglooPopulation.HasValue)
        {
            roomPopulation = iglooListItem.iglooPopulation.Value;
        }
        component.RoomPopulation = roomPopulation;
    }
Esempio n. 8
0
        private void showOwner(SceneOwnerData ownerData)
        {
            ownerHandle = PlayerDataEntityFactory.CreateRemotePlayerEntity(dataEntityCollection, ownerData.Name);
            ownerDisplay.SetPlayer(ownerHandle);
            ProfileData    component;
            bool           flag = dataEntityCollection.TryGetComponent <ProfileData>(ownerHandle, out component);
            MembershipData component2;
            bool           flag2 = dataEntityCollection.TryGetComponent <MembershipData>(ownerHandle, out component2);

            if (!flag || !flag2)
            {
                Service.Get <OtherPlayerDetailsRequestBatcher>().RequestOtherPlayerDetails(ownerHandle);
            }
            if (flag)
            {
                bool isOnline = getIsOnline(ownerHandle);
                ownerDisplay.SetOnlineStatus(isOnline);
                renderOwner(ownerDisplay, ownerHandle, ownerData.Name, isOnline);
            }
            ownerDisplay.SetMembershipType(getMembershipType(ownerHandle));
        }
 public void OnFindUserSent(bool success, IUnidentifiedUser searchedUser)
 {
     if (!success)
     {
         return;
     }
     if (!dataEntityCollection.TryFindEntity <DisplayNameData, string>(searchedUser.DisplayName.Text, out DataEntityHandle dataEntityHandle))
     {
         dataEntityHandle = PlayerDataEntityFactory.CreateRemotePlayerEntity(dataEntityCollection, searchedUser.DisplayName.Text);
     }
     if (!dataEntityCollection.TryGetComponent(dataEntityHandle, out SearchedUserData component))
     {
         DataEntityHandle entityByType = dataEntityCollection.GetEntityByType <SearchedUserData>();
         if (!entityByType.IsNull)
         {
             dataEntityCollection.RemoveComponent <SearchedUserData>(entityByType);
         }
         component = dataEntityCollection.AddComponent <SearchedUserData>(dataEntityHandle);
     }
     component.SearchedUser = searchedUser;
 }
    private void addOtherPlayerDetails(OtherPlayerData data)
    {
        DataEntityHandle handle;

        if (data.id.type == PlayerId.PlayerIdType.SWID)
        {
            handle = dataEntityCollection.FindEntity <SwidData, string>(data.id.id);
            if (DataEntityHandle.IsNullValue(handle))
            {
                handle = PlayerDataEntityFactory.CreateRemotePlayerEntity(dataEntityCollection, data.name);
            }
        }
        else
        {
            handle = PlayerDataEntityFactory.CreateRemotePlayerEntity(dataEntityCollection, data.name);
        }
        if (!dataEntityCollection.TryGetComponent(handle, out AvatarDetailsData component))
        {
            component = dataEntityCollection.AddComponent <AvatarDetailsData>(handle);
        }
        if (!dataEntityCollection.TryGetComponent(handle, out ProfileData component2))
        {
            component2 = dataEntityCollection.AddComponent <ProfileData>(handle);
        }
        if (!dataEntityCollection.TryGetComponent(handle, out MembershipData component3))
        {
            component3 = dataEntityCollection.AddComponent <MembershipData>(handle);
        }
        if (!dataEntityCollection.TryGetComponent(handle, out PresenceData component4))
        {
            component4 = dataEntityCollection.AddComponent <PresenceData>(handle);
        }
        setUpAvatarDetails(component, data);
        setUpProfile(component2, component4, component3, data);
        component4.IsDisconnecting = false;
    }