Ejemplo n.º 1
0
        /// <summary>
        /// Gets the user account.
        /// </summary>
        /// <param name="userName">Name of the user.</param>
        /// <returns>An account container.</returns>
        public AccountContainer GetUserAccountContainer(string userName)
        {
            var account = new AccountContainer {
                IsEmpty = true, Profile = null, Roles = null, User = null
            };
            var container = this.FindUser(userName);

            if (container.IsEmpty)
            {
                return(account);
            }

            account.User = container.User;
            try
            {
                account.Profile          = UserProfile.GetUserProfile(userName);
                account.Roles            = Roles.Providers[container.Providers.Role].GetRolesForUser(userName);
                account.StateAssignments = this.stateAssignmentRepository.SearchFor(x => x.UserName.Equals(userName)).ToList();
                account.IsEmpty          = false;
            }
            catch (Exception e)
            {
                account.IsEmpty = true;
                var logInfo = new LogInformation
                {
                    ClassName         = "AccountManager",
                    MethodName        = "GetUserAccountContainer",
                    ArgumentsPassedIn = new string[] { userName },
                    ErrorMessage      = e.Message
                };
                this.logger.Error(JsonConvert.SerializeObject(logInfo));
            }

            return(account);
        }
Ejemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     Debug.Log(main);
     main = true;
     Application.targetFrameRate = 60;
     PenghargaanContainer.load();
     PenghargaanController.load();
     AudioController.Load();
     acc = AccountContainer.load().accounts;
     if (!AudioController.getInstance().containKey("MainMenu"))
     {
         AudioSource audio = AudioController.getInstance().registerSound("Audio/Intro insyaAllah fix", "MainMenu");
         DontDestroyOnLoad(audio);
         audio.loop = true;
         audio.Play();
     }
     else
     {
         AudioSource audio = AudioController.getInstance().getAudioSource("MainMenu");
         audio.UnPause();
     }
     restartOption();
     SaveGameUI.SetActive(false);
     Scene.moveOut();
 }
Ejemplo n.º 3
0
 public void load()
 {
     try {
         AccountContainer acc = AccountContainer.self;
         acc.loadGame(acc.accounts[savesDropdown.value]);
         Debug.Log(acc.currentAccount.name);
         namePlayers.text = "HAI " + AccountContainer.self.currentAccount.name + " !";
     }
     catch (System.Exception e)
     {
     }
 }
Ejemplo n.º 4
0
 public void newSaveGame()
 {
     try
     {
         AccountContainer acc = AccountContainer.self;
         acc.addNewSaveGame(inputNewSave.text);
         acc.loadGame(inputNewSave.text);
         restartOption();
     }
     catch (System.Exception e)
     {
     }
 }
Ejemplo n.º 5
0
    // Use this for initialization
    void Start()
    {
        Application.targetFrameRate = 60;
        PenghargaanContainer.load();
        PenghargaanController.load();
        AudioController.Load();
        acc = AccountContainer.load().accounts;
        AudioSource audio = AudioController.getInstance().registerSound("Audio/Intro insyaAllah fix", "MainMenu");

        audio.loop = true;
        audio.Play();
        restartOption();
        saveClose();
    }
Ejemplo n.º 6
0
 public void deleteSaveGame()
 {
     try
     {
         AccountContainer acc = AccountContainer.self;
         acc.deleteAccount(acc.accounts[savesDropdown.value].name);
         savesDropdown.value = 0;
         acc.currentAccount  = null;
         restartOption();
     }
     catch (System.Exception e)
     {
     }
 }
Ejemplo n.º 7
0
 public static PenghargaanController load()
 {
     if (self == null)
     {
         self    = new PenghargaanController();
         self.AC = AccountContainer.load();
         self.PC = PenghargaanContainer.load();
         return(self);
     }
     else
     {
         return(self);
     }
 }
Ejemplo n.º 8
0
    void layoutPenghargaan()
    {
        PenghargaanContainer pc = PenghargaanContainer.self;
        AccountContainer     ac = AccountContainer.self;
        int index = 0;

        foreach (Penghargaan p in pc.penghargaans)
        {
            Transform a = Instantiate(penghargaanPrefab.transform, penghargaanContentContainer.transform);
            a.localPosition += new Vector3((index % 4) * dx, (index / 4) * dy * -1, 0);
            //a.localPosition = new Vector3(oriX + (index % 5) * dx, oriY + (index / 5) * dy, 0);
            a.gameObject.name = p.name;
            a.gameObject.SetActive(true);
            index++;

            if (ac.currentAccount.getPenghargaan(p))
            {
                a.GetComponent <Image>().sprite = Resources.Load <Sprite>("Penghargaan/Gambar/" + p.imageName);
            }
        }
    }
        public static IServiceCollection AddCosmosDbServices(this IServiceCollection services, IConfiguration configuration)
        {
            var connectionString     = configuration.GetValue <string>("ConnectionStrings:CosmosDb");
            var DatabaseName         = configuration.GetValue <string>("CosmosDb:Database");
            var accountContainerName = configuration.GetValue <string>("CosmosDb:AccountContainerName");



            services.AddSingleton(_ =>
            {
                var cosmosClient = new CosmosClient(connectionString);
                return(cosmosClient);
            });

            services.AddScoped(p =>
            {
                var cosmosClient     = p.GetService <CosmosClient>();
                var accountContainer = new AccountContainer(cosmosClient.GetContainer(DatabaseName, accountContainerName));
                return(accountContainer);
            });

            return(services);
        }
    protected override void instantiate <T>()
    {
        base.instantiate <KarapanGameControl>();
        base.name        = Name;
        userInputControl = gameObject.GetComponent <UserInputControl>();
        playerControl    = GameObject.Find("Player").GetComponent <KarapanPlayerControl>();

        lifeControl     = gameObject.GetComponent <KarapanLifeControl>();
        speedControl    = gameObject.GetComponent <KarapanSpeedControl>();
        progressControl = gameObject.GetComponent <ProgressControl>();
        playerControl   = GameObject.Find("Player").GetComponent <KarapanPlayerControl>();
        addSubController("LifeControl", lifeControl);
        addSubController("SpeedControl", speedControl);
        addSubController("PlayerControl", playerControl);
        addSubController("ProgressControl", progressControl);
        addSubController("UserInputControl", userInputControl);

        UnityEngine.Debug.Log(userInputControl);
        userInputControl.addKeyMap(new KeyMap(new KeyCode[] { KeyCode.Space }, "TogglePause", delegate() { togglePause(); }, Input.GetKeyDown, 0.75F));
        userInputControl.addKeyMap(new KeyMap(new KeyCode[] { KeyCode.Slash }, "DEBUG", delegate() { toggleDebug(); }, Input.GetKeyDown, UserInputControl.SeldomtimePress));
        userInputControl.addKeyMap(new KeyMap(new KeyCode[] { KeyCode.Equals }, "reset", delegate() { gameOver(); resetGame(); }, Input.GetKeyDown, UserInputControl.SometimePress));
        AccountContainer.load();
    }
Ejemplo n.º 11
0
 public static AccountContainer load()
 {
     if (self == null)
     {
         checkDirectory();
         string path;
         path = "file://" + Application.dataPath + "/SaveGame/SaveGame.xml";
         WWW file = new WWW(path);
         if (!file.text.Equals(""))
         {
             while (!file.isDone)
             {
                 ;
             }
             XmlSerializer serializer = new XmlSerializer(typeof(AccountContainer));
             StringReader  s          = new StringReader(file.text);
             self = serializer.Deserialize(s) as AccountContainer;
             foreach (Account a in self.accounts)
             {
                 a.updateNewGameSave(MinigameContainer.loadMinigame().minigames);
                 a.updateNewPenghargaanSave(PenghargaanContainer.load().penghargaans);
                 self.Save();
             }
             return(self);
         }
         else
         {
             AccountContainer a = new AccountContainer();
             a.Save();
             return(a);
         }
     }
     else
     {
         return(self);
     }
 }
Ejemplo n.º 12
0
 public ForumController(ForumContainer forumcontainer, PostContainer postcontainer, AccountContainer accountcontainer)
 {
     this.forumContainer   = forumcontainer;
     this.postContainer    = postcontainer;
     this.accountContainer = accountcontainer;
 }
Ejemplo n.º 13
0
 public AccountController(AccountContainer container)
 {
     this.accountContainer = container;
 }
Ejemplo n.º 14
0
 void Start()
 {
     acc = AccountContainer.self;
     loadGame();
 }
Ejemplo n.º 15
0
 public LoginController(AccountContainer container, ILoggerFactory logger)
 {
     _logger = logger.CreateLogger("MyCategory");
     this.accountContainer = container;
 }
Ejemplo n.º 16
0
 public AccountRepository(AccountContainer accountContainer,
                          IConfiguration configuration) : base(accountContainer, configuration)
 {
     _accountContainer = accountContainer;
     _configuration    = configuration;
 }
Ejemplo n.º 17
0
 public MessageController(AccountContainer aContainer, MessageContainer mContainer)
 {
     this.accountContainer = aContainer;
     this.messageContainer = mContainer;
 }
Ejemplo n.º 18
0
        public static string SongInfoToString(string pattern, SongInfo songInfo, bool enableAutoShorten, AccountContainer acccon)
        {
            var tweet = SongInfoToString(pattern, songInfo);

            if (enableAutoShorten && acccon.CountText(tweet) > acccon.MaxTweetLength)
            {
                while (!(acccon.MaxTweetLength - acccon.CountText(tweet) >= 3))
                {
                    tweet = tweet.Remove(tweet.Length - 1);
                }
                tweet += "...";
            }
            return(tweet);
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Populates the user add model with account container.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <param name="container">The container.</param>
        public static void PopulateUserAddModelWithAccountContainer(UserAddModel model, AccountContainer container)
        {
            // update user information
            model.UserName = container.User.UserName;

            // update profile information
            MapProfileToUserAddModel(container.Profile, model);

            // update roles
            model.RoleSelections.ForEach(x => x.IsChecked = container.Roles.Contains(x.RoleName));

            // update state assignments
            var selectedStates = container.StateAssignments.Select(x => x.StateId);

            model.CheckboxStateSelections.ForEach(x => x.IsChecked = selectedStates.Contains(x.StateId));
        }