Example #1
0
        static void Main(string[] args)
        {
            Player player = new Player
            {
                FirstName   = "Nurettin",
                LastName    = "Ayıpettin",
                NationalId  = 85941736744,
                YearOfBirth = 1881,
                Nickname    = "CokPisOynarım_5334"
            };
            Game game = new Game {
                NameOfGame = "Call of Duty", Price = 1000
            };

            SpecialOffer specialOffer = new SpecialOffer {
                NameOfOffer = "Super Discount", DiscountPercent = 20
            };

            PlayerAccountManager playerAccountManager = new PlayerAccountManager(new PlayerCheckManager());

            playerAccountManager.SignUp(player);
            Console.WriteLine("----");

            SalesManager salesManager = new SalesManager();

            salesManager.SellGame(player, game);
            Console.WriteLine("----");


            SpecialOfferManager specialOfferManager = new SpecialOfferManager();

            specialOfferManager.AddOffer(specialOffer, game);
            Console.WriteLine("----");
            salesManager.DiscountSale(specialOffer, game);
        }
Example #2
0
        public void OnSubmit()
        {
            string name = nameField.text;

            Debug.Log("Captain: " + name);

            PlayerAccountManager pam = PlayerAccountManager.GetInstance();

            // Initialize a new player and save it.
            pam.InitializeNewPlayer(name);

            pam.SavePlayer(pam.CurrSaveSlot);

            // Close all the screens and then start loading
            List <AssetLoadRequestTO> requests = new List <AssetLoadRequestTO>();

            AssetLoadRequestTO baseData =
                AssetLoadRequestTO.CreateMetadataAssetRequest(GameConstants.METADATA_BASE_FILE);

            requests.Add(baseData);

            AssetLoadRequestTO ep1 = AssetLoadRequestTO.CreateConversationRequest(GameConstants.EP01);

            requests.Add(ep1);

            // load the map csv file.
            //AssetLoadRequestTO map = AssetLoadRequestTO.CreateMapDataRequest(GameConstants.MAP_1);
            //requests.Add(map);

            EventController.GetInstance().RegisterForEvent(
                EventTypeEnum.AssetsLoadMultipleComplete, OnLoadCompleteEvent);

            AssetLoader.GetInstance().LoadAssets(requests);
        }
Example #3
0
    public void SetPlayerAccountData(PlayerAccountManager pm)
    {
        CreditAccountData        data      = new CreditAccountData(pm.CreditAccount.Balance, pm.CreditAccount.CutDate, pm.CreditAccount.InterestRate, pm.CreditAccount.CurrentCredit.CreditLimit, pm.CreditAccount.transactions);
        List <CreditAccountData> historial = new List <CreditAccountData>();

        for (int i = 0; i < pm.WeeklyCreditState.Count; i++)
        {
            historial.Add(new CreditAccountData(pm.WeeklyCreditState[i].Balance, pm.WeeklyCreditState[i].CutDate, pm.WeeklyCreditState[i].InterestRate, pm.WeeklyCreditState[i].CurrentCredit.CreditLimit, pm.WeeklyCreditState[i].transactions));
        }
        accountData = new PlayerAccountData(pm.Gold, pm.CreditAccount.InterestRate, pm.CreditAccount.CurrentCredit.CreditLimit, data, historial, pm.transactions);
    }
Example #4
0
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }

        CreditAccount     = new CreditAccountState(0, DateTime.Now.ToString(), new Credit(0, 0));
        transactions      = new List <Transaction>();
        WeeklyCreditState = new List <CreditAccountState>();
    }
Example #5
0
        /// <summary>
        /// We save a conversation is complete by saving the starting node id.
        /// </summary>
        /// <param name="conv"></param>
        private void SaveConversationComplete(Conversation conv)
        {
            ConversationNode startNode = conv.nodeMap[conv.startNodeTitle];

            // Flag that whole conversation tree as complete
            PlayerAccountManager.GetInstance().GetPlayer().SetValue <int>(startNode.treeID, 1);

            // Auto save the player
            PlayerAccountManager pm = PlayerAccountManager.GetInstance();

            pm.AutoSavePlayerToCurrentSlot();
        }
Example #6
0
        protected override void OnYes()
        {
            // Set the current save slot
            PlayerAccountManager.GetInstance().CurrSaveSlot = SlotNum;

            Debug.Log("SaveFile Yes");

            // Pop the name input screen
            GameObject MainMenu        = GameObject.Find(GameConstants.UI_MAIN_MENU);
            GameObject nameInputScreen = UIFactory.CreateScreen(UIFactory.SCR_NAME_INPUT, MainMenu);

            ScreenQueueManager sqm = ScreenQueueManager.GetInstance();

            sqm.QueueScreenAsNext(nameInputScreen);
            sqm.QueueScreen(parentScreen);
        }
        // Use this for initialization
        public override void Start()
        {
            base.Start();

            //// add all the save slots
            for (int i = 0; i < GameConstants.NUM_SAVE_SLOTS; i++)
            {
                // Try loading up a save file
                SaveData save = PlayerAccountManager.GetInstance().LoadSaveFile(PlayerAccountManager.SAVE_FILE_PREFIX + i);

                // If we didn't find a save file in that slot then make an empty one
                if (save == null)
                {
                    save = new SaveData(null);
                }

                GetNewSaveFileButton(save, i);
            }
        }
Example #8
0
        private void ApplyParamModifiers(ConversationNode node)
        {
            if (node.paramMods == null || node.paramMods.Count < 1)
            {
                return;
            }

            PlayerAccountManager pm = PlayerAccountManager.GetInstance();
            Player player           = pm.GetPlayer();

            for (int i = 0, count = node.paramMods.Count; i < count; i++)
            {
                ConversationParamModifier mod = node.paramMods[i];

                // If it's a music parameter then play the transition
                if (ParameterModifierUtils.IsMusicParameter(mod.paramName))
                {
                    if (mod.paramName == MusicController.DIALOG_PARAM_MUSIC_FADEIN)
                    {
                        MusicController.GetInstance().TransitionToNewSong(mod.strValue);
                    }

                    if (mod.paramName == MusicController.DIALOG_PARAM_MUSIC_FADEOUT)
                    {
                        MusicController.GetInstance().FadeOutCurrentSong();
                    }

                    continue;
                }

                if (ParameterModifierUtils.IsScreenParameter(mod.paramName))
                {
                    if (mod.paramName == PMOD_SCREEN_QUEUE)
                    {
                        GameObject MainMenu = GameObject.Find(GameConstants.UI_MAIN_MENU);
                        GameObject screen   = UIFactory.CreateScreen(mod.strValue, MainMenu);
                        ScreenQueueManager.GetInstance().QueueScreen(screen);
                    }
                    continue;
                }

                if (ParameterModifierUtils.IsMapParameter(mod.paramName))
                {
                    // Preload a map
                    if (mod.paramName == PMOD_MAP_PRELOAD)
                    {
                        MapController.GetInstance().LoadMapByUID(mod.strValue);
                    }

                    if (mod.paramName == PMOD_MAP_SHOW)
                    {
                        MapController.GetInstance().ShowMap();
                    }

                    continue;
                }

                // Set the string or integer to the given value.
                if (mod.action == ConversationParamModifier.ModifierActionType.Set)
                {
                    if (mod.type == ConversationParamModifier.ModifierType.Integer)
                    {
                        player.SetValue <int>(mod.paramName, mod.intValue);
                    }
                    else
                    {
                        player.SetValue <string>(mod.paramName, mod.strValue);
                    }
                    continue;
                }

                if (mod.action == ConversationParamModifier.ModifierActionType.Increment)
                {
                    player.IncrementValue(mod.paramName, mod.intValue);
                    continue;
                }

                if (mod.action == ConversationParamModifier.ModifierActionType.Decrement)
                {
                    player.IncrementValue(mod.paramName, -mod.intValue);
                    continue;
                }
            }

            // Save the player progress at this point.
            pm.AutoSavePlayerToCurrentSlot();
        }
Example #9
0
 private void SaveDecision(ConversationNode node, int choice)
 {
     PlayerAccountManager.GetInstance().GetPlayer().SetValue <int>(node.title, choice);
 }