private void Start()
 {
     customClient = LobbyManager.Instance.usedList[0];
     LobbyManager.Instance.usedList.RemoveAt(0);
     gameObject.GetComponent <Image>().sprite = customClient.artwork;
     populate = selectedSharkPanel.GetComponent <PopulateSelected>();
 }
Beispiel #2
0
    private void CreateShark()
    {
        //Replace/Add to these later with a while loop that gets another value until there are no sharks that have the same artwork (to account for both Custom and Trash sharks).
        if (sharkType)
        {
            //Gets a random custom client
            CustomClients randomCustClient = customClients[Random.Range(0, customClients.Count)];

            gameObject.GetComponent <Image>().sprite = randomCustClient.artwork;
            profileImage.sprite = gameObject.GetComponent <Image>().sprite;
            nameText.text       = randomCustClient.name;
            bioText.text        = randomCustClient.bio;
        }
        else
        {
            //Gets a random trash client (WIP)
            //Replace with trash clients when we get them ready.
            CustomClients randomClient = customClients[Random.Range(0, customClients.Count)];

            Debug.Log("I'm supposed to be trash sharks but we don't have any yet so I'll just use custom sharks aswell RIP.");

            gameObject.GetComponent <Image>().sprite = randomClient.artwork;
            profileImage.sprite = gameObject.GetComponent <Image>().sprite;
            nameText.text       = randomClient.name;
            bioText.text        = randomClient.bio;
        }
    }
    private void StartGameScene()
    {
        gamePanel.SetActive(true);
        moneyObject.SetActive(false);
        finalScoreObject.SetActive(false);
        startBtn.SetActive(true);
        lobbyManager = LobbyManager.Instance;
        Debug.Log(lobbyManager.selectedClient.name);

        //Check type of the selected Client
        if (lobbyManager.selectedClient is CustomClients)
        {
            customClient = (CustomClients)lobbyManager.selectedClient;
            int clientTraitsNum = customClient.likedTraits.Count;
            selectedClientName.text    = customClient.name;
            staticSelectedClientName   = customClient.name;
            selectedClientImage.sprite = customClient.artwork;
            for (int i = 0; i < clientTraitsNum; i++)
            {
                selectedClientTraits[i].GetComponent <Image>().sprite = customClient.likedTraits[i].traitImage;
                selectedClientTraits[i].SetActive(true);
            }
        }
        else
        {
            Debug.Log("I shouldnt be in here");
        }
    }
  private void Populate()
  {
      //string currentClient = FindrManager.main.selectedClientName.text;
      string           currentClient = FindrManager.staticSelectedClientName;
      int              randRange     = MatcheeList.Count;
      ScriptableObject matchee;

      matchee = MatcheeList[UnityEngine.Random.Range(0, randRange)];
      while (matchee.name == currentClient)
      {
          matchee = MatcheeList[UnityEngine.Random.Range(0, randRange)];
      }

      if (matchee is CustomClients)
      {
          CustomClients cMatchee = (CustomClients)matchee;
          ProfilePic.sprite = cMatchee.artwork;
          Name.text         = cMatchee.name;
          Bio.text          = cMatchee.bio;
          foreach (Image i in Traits)
          {
              int randVal = UnityEngine.Random.Range(0, TraitList.Count);
              while (usedTraitNums.Contains(randVal))
              {
                  randVal = UnityEngine.Random.Range(0, TraitList.Count);
              }
              usedTraitNums.Add(randVal);
              i.sprite = TraitList[randVal].traitImage;
          }
      }
      else if (matchee is NormalClients)
      {
          NormalClients nMatchee = (NormalClients)matchee;
          ProfilePic.sprite = nMatchee.artwork;
          Name.text         = nMatchee.name;
          Bio.text          = nMatchee.bio;
          foreach (Image i in Traits)
          {
              int randVal = UnityEngine.Random.Range(0, TraitList.Count);
              while (usedTraitNums.Contains(randVal))
              {
                  randVal = UnityEngine.Random.Range(0, TraitList.Count);
              }
              usedTraitNums.Add(randVal);
              i.sprite = TraitList[randVal].traitImage;
          }
      }
  }
Beispiel #5
0
        public IServiceClient RegisterCustomClient(string baseUri)
        {
            if (string.IsNullOrWhiteSpace(baseUri))
            {
                throw new ArgumentOutOfRangeException(nameof(baseUri));
            }

            if (CustomClients.TryGetValue(baseUri, out var client))
            {
                return(client);
            }

            client = ClientHelper.CloneAuthenticatedClient(Publish as JsonServiceClient, baseUri);
            AddCustomClient(baseUri, client);

            return(client);
        }
    //Gets random clients, (idk if this shit works)
    private void GetRandomClients(int capacity)
    {
        Debug.Log("Random Client Capacity: " + capacity); //Looks like its getting the correct number here.

        //Only get Custom Client for now will fill up with more once we have more sharks.

        if (randomizedList != null)
        {
            randomizedList.Clear();
        }

        randomizedList = new List <CustomClients>(capacity);

        //Theres definately something wrong here but f**k arrays and lists. But also I'm 100% sure I'm making this harder then I need to be.
        for (int i = 0; i < capacity; i++)
        {
            //Gets a random client from the list and assigns it
            CustomClients randomClient = customClientList[Random.Range(0, customClientList.Count)];

            //Checks the randomized list to see if it already contains this (maybe, I mean thats what I think it should be doing, maybe it isn't doing that, f**k me).
            if (!randomizedList.Contains(randomClient))
            {
                randomizedList.Add(randomClient);
            }
            else
            {
                //I'm pretty sure this is toxic and might crash u so save before u end up using this.
                int sharkCount = 0;
                while (randomizedList.Count < capacity && sharkCount < customClientList.Count)
                {
                    //Idk just some stuff that looks correct but prolly isn't
                    randomizedList.Remove(randomClient);
                    randomClient = customClientList[Random.Range(0, customClientList.Count)];
                    randomizedList.Add(randomClient);
                    sharkCount++;
                }
            }
        }
        usedList = randomizedList;

        /*foreach (CustomClients c in usedList)
         * {
         *  Debug.Log(c.name);
         * }
         * Debug.Log("----------");*/
    }
Beispiel #7
0
        public void Configuration(IAppBuilder app)
        {
            // Configure the db context and user manager to use a single instance per request
            app.CreatePerOwinContext(ApplicationDbContext.Create);
            app.CreatePerOwinContext <ApplicationUserManager>(ApplicationUserManager.Create);

            app.Map("/identity", idsrvApp =>
            {
                var corsPolicyService = new DefaultCorsPolicyService()
                {
                    AllowAll = true
                };

                var defaultViewServiceOptions        = new DefaultViewServiceOptions();
                defaultViewServiceOptions.CacheViews = false;

                var idServerServiceFactory = new IdentityServerServiceFactory()
                                             .UseInMemoryClients(CustomClients.Get())
                                             .UseInMemoryScopes(CustomScopes.Get());
                //.UseInMemoryUsers(CustomUsers.Get());

                idServerServiceFactory.CorsPolicyService = new
                                                           Registration <IdentityServer3.Core.Services.ICorsPolicyService>(corsPolicyService);

                idServerServiceFactory.ConfigureDefaultViewService(defaultViewServiceOptions);

                idServerServiceFactory.Register(new Registration <ApplicationDbContext>());
                idServerServiceFactory.Register(new Registration <UserStore <ApplicationUser> >(resolver =>
                {
                    return(new UserStore <ApplicationUser>(resolver.Resolve <ApplicationDbContext>()));
                }));
                idServerServiceFactory.Register(new Registration <UserManager <ApplicationUser> >(resolver =>
                {
                    return(new ApplicationUserManager(resolver.Resolve <UserStore <ApplicationUser> >()));
                }));

                idServerServiceFactory.UserService = new Registration <IUserService, CustomUserService>();

                var options = new IdentityServerOptions
                {
                    Factory = idServerServiceFactory,

                    // Just for Angular 2 App testing.
                    RequireSsl = false,

                    SiteName              = "TripCompany Security Token Service",
                    SigningCertificate    = LoadCertificate(),
                    IssuerUri             = DBSP.RememberMe.Identity.Constants.TripGalleryIssuerUri,
                    PublicOrigin          = DBSP.RememberMe.Identity.Constants.TripGallerySTSOrigin,
                    AuthenticationOptions = new AuthenticationOptions()
                    {
                        EnablePostSignOutAutoRedirect = true,
                        LoginPageLinks = new List <LoginPageLink>()
                        {
                            new LoginPageLink()
                            {
                                Type = "createaccount",
                                Text = "Create a new account",
                                Href = "~/createuseraccount"
                            }
                        }
                    },
                    CspOptions = new CspOptions()
                    {
                        Enabled = false
                                  // once available, leave Enabled at true and use:
                                  // FrameSrc = "https://localhost:44318 https://localhost:44316"
                                  // or
                                  // FrameSrc = "*" for all URI's.
                    }
                };
                idsrvApp.UseIdentityServer(options);
            });
        }