コード例 #1
0
ファイル: LoadShop.cs プロジェクト: jfonz412/combatTest
 public void LoadShopInventory()
 {
     Debug.Log("Loading inventory for " + gameObject.name);
     shopInventory = EconomyManager.GetInstance().GetMarketInventory().GetInventory(gameObject.name).ToList(); //get this unit's inventory
     InventoryManager.GetInstance().GetShopInventory().LoadShopInventory(shopInventory, this);                 //load inventory window with this
     InventoryManager.GetInstance().GetShopDialogue().LoadShopDialogue(shopDialogue);                          //get shop dialog window
 }
コード例 #2
0
        public override void HandleCommand(NotifyTextMessageEvent evt, string command, List <string> parameters, Action <string> messageCallback)
        {
            CooldownManager.ThrowIfCooldown(evt.InvokerUniqueId, "command:daily");

            int currentBalance = EconomyManager.GetBalanceForUser(evt.InvokerUniqueId);

            if (currentBalance + Settings.DailyReward > Settings.EcoSoftBalanceLimit)
            {
                messageCallback.Invoke(ColorCoder.ErrorBright($"You would have more than {ColorCoder.Currency(Settings.EcoSoftBalanceLimit, Settings.EcoPointUnitName)}, {ColorCoder.Username(evt.InvokerName)}. Your balance: {ColorCoder.Currency(currentBalance, Settings.EcoPointUnitName)} |  Daily reward: {ColorCoder.Currency(Settings.DailyReward, Settings.EcoPointUnitName)}"));
                return;
            }


            DateTime cooldownDue = DateTime.Today.AddDays(1).AddHours(7);
            DateTime todayCheck  = DateTime.Today.AddHours(7);

            if (todayCheck > DateTime.Now)
            {
                cooldownDue = todayCheck;
            }

            CooldownManager.SetCooldown(evt.InvokerUniqueId, "command:daily", cooldownDue);

            EconomyManager.ChangeBalanceForUser(evt.InvokerUniqueId, Settings.DailyReward);
            messageCallback.Invoke(ColorCoder.SuccessDim($"{ColorCoder.Currency(Settings.DailyReward, Settings.EcoPointUnitName)} have been added to your balance as daily reward, {ColorCoder.Username(evt.InvokerName)}"));
        }
コード例 #3
0
        private void setTaxMultiplier(int value)
        {
            EconomyManager em    = Singleton <EconomyManager> .instance;
            FieldInfo      field = em.GetType().GetField("m_taxMultiplier", BindingFlags.NonPublic | BindingFlags.Instance);

            field.SetValue(em, value);
        }
コード例 #4
0
 void Start()
 {
     populationManager = ReferenceManager.instance.populationManager;
     economyManager    = ReferenceManager.instance.economyManager;
     happinessManager  = ReferenceManager.instance.happinessManager;
     itemManager       = ReferenceManager.instance.itemManager;
 }
コード例 #5
0
        public void Start()
        {
            _matchManager   = FindObjectOfType <MatchManager>();
            _economyManager = FindObjectOfType <EconomyManager>();

            TurnManager.onTurnReset += GenerateMoney;
        }
コード例 #6
0
        public static void SetLoans()
        {
            if (isAlreadySet)
            {
                return;
            }

            EconomyManager   em = Singleton <EconomyManager> .instance;
            GameSpeedManager gs = Singleton <GameSpeedManager> .instance;

            if (em.m_properties == null || em.m_properties.m_banks == null)
            {
                return;
            }

            for (int i = 0; i < 3; i++)
            {
                int oldAmount = em.m_properties.m_banks[i].m_loanOffers[0].m_amount;
                int oldLength = em.m_properties.m_banks[i].m_loanOffers[0].m_length;

                int newAmount = oldAmount * gs.Parameters.LoanMultiplier;
                int newLength = oldLength * (1 + gs.Parameters.LoanMultiplier) / 2; // Halve the effect to prevent too long loan length.

                em.m_properties.m_banks[i].m_loanOffers[0].m_amount = newAmount;
                em.m_properties.m_banks[i].m_loanOffers[0].m_length = newLength;

                ModLogger.Add(em.m_properties.m_banks[i].m_bankName, "amount", oldAmount, newAmount, "length", oldLength, newLength);
            }

            isAlreadySet = true;
        }
コード例 #7
0
 // Use this for initialization
 void Start()
 {
     _playerLink          = GameManager.Instance.SceneManagerLink.GetComponent <PlayerManager>();
     _economyLink         = GameManager.Instance.SceneManagerLink.GetComponent <EconomyManager>();
     _customerManagerLink = GameManager.Instance.ScriptHolderLink.GetComponent <CustomerManager>();
     arcadeName.text      = _playerLink.ArcadeName;
 }
コード例 #8
0
        //private void BudgetPanel_eventVisibilityChanged(UIComponent component, bool value)
        //{
        //    if (taxMultiplierPanel == null)
        //    {
        //        GameObject obj = new GameObject("TaxMultiplierPanel");
        //        obj.transform.parent = UIView.GetAView().cachedTransform;
        //        taxMultiplierPanel = obj.AddComponent<TaxMultiplierPanel>();
        //        taxMultiplierPanel.name = "TaxMultiplierPanel";
        //    }

        //    if (value && taxMultiplierPanel.absolutePosition == Vector3.zero)
        //    {
        //        Vector3 economyPanelPos = ToolsModifierControl.economyPanel.component.absolutePosition;
        //        taxMultiplierPanel.absolutePosition = new Vector3(economyPanelPos.x + 27, economyPanelPos.y + 598);
        //    }

        //    taxMultiplierPanel.isVisible = value;
        //}

        public int GetTaxMultiplier()
        {
            EconomyManager em    = Singleton <EconomyManager> .instance;
            FieldInfo      field = em.GetType().GetField("m_taxMultiplier", BindingFlags.NonPublic | BindingFlags.Instance);

            return((int)field.GetValue(em));
        }
コード例 #9
0
        public override void OnLevelLoaded(LoadMode mode)
        {
            EconomyManager    em = Singleton <EconomyManager> .instance;
            DifficultyManager d  = Singleton <DifficultyManager> .instance;

            if (mode == LoadMode.NewGame)
            {
                int moneyToAdd = (d.InitialMoney.Value - 70) * 100000;
                em.AddResource(EconomyManager.Resource.LoanAmount, moneyToAdd, ItemClass.Service.None, ItemClass.SubService.None, ItemClass.Level.None);
            }

            if (mode == LoadMode.NewGame || mode == LoadMode.LoadGame)
            {
                for (int i = 0; i < 3; i++)
                {
                    EconomyManager.Bank     bank = em.m_properties.m_banks[i];
                    EconomyManager.LoanInfo li   = bank.m_loanOffers[0];

                    int newAmount = (int)Math.Round(li.m_amount * 0.01f * d.LoanMultiplier.Value);
                    int newLength = (int)Math.Round(li.m_length * (1 + 0.01f * d.LoanMultiplier.Value) / 2f); // Halve the effect to prevent too long loan length.
                    Helper.ValueChangedMessage(bank.m_bankName, "Loan amount", li.m_amount, newAmount);
                    Helper.ValueChangedMessage(bank.m_bankName, "Loan length", li.m_length, newLength);
                    li.m_amount = newAmount;
                    li.m_length = newLength;

                    bank.m_loanOffers[0]       = li;
                    em.m_properties.m_banks[i] = bank;
                }
            }

            Achievements.Update();

            PrefabsManager.UpdatePrefabs(false);
            NetManager.UpdateSlopes(false);
        }
コード例 #10
0
        public override void OnLevelLoaded(LoadMode mode)
        {
            EconomyManager    em = Singleton <EconomyManager> .instance;
            DifficultyManager d  = Singleton <DifficultyManager> .instance;

            if (mode == LoadMode.NewGame)
            {
                int moneyToAdd = (d.InitialMoney.Value - 70) * 100000;
                em.AddResource(EconomyManager.Resource.LoanAmount, moneyToAdd, ItemClass.Service.None, ItemClass.SubService.None, ItemClass.Level.None);
            }

            if (mode == LoadMode.NewGame || mode == LoadMode.LoadGame)
            {
                for (int i = 0; i < 3; i++)
                {
                    EconomyManager.Bank     bank = em.m_properties.m_banks[i];
                    EconomyManager.LoanInfo li   = bank.m_loanOffers[0];

                    li.m_amount = (int)Math.Round(0.01f * li.m_amount * d.LoanMultiplier.Value);
                    li.m_length = (int)Math.Round(0.01f * li.m_length * d.LoanMultiplier.Value);

                    bank.m_loanOffers[0]       = li;
                    em.m_properties.m_banks[i] = bank;
                    //DebugOutputPanel.AddMessage(PluginManager.MessageType.Message, bank.m_bankName);
                }
            }

            Achievements.Update();

            PrefabsManager.UpdatePrefabs(false);
        }
コード例 #11
0
    private void dropHeldObject()
    {
        EconomyManager EM = TurnManager.instance.currentPlayer().wallet;

        EM.Add(heldObjectPrice);
        stopHolding();
    }
コード例 #12
0
 private void OnDestroy()
 {
     if (this == instance)
     {
         instance = null;
     }
 }
コード例 #13
0
ファイル: ResetManager.cs プロジェクト: JerryGQian/Sandwich
    public static void completeReset()
    {
        reset();
        WorldManager   wm = Util.wm;
        EconomyManager em = Util.em;

        wm.playthroughCount = 0;

        //transfer into totals
        em.elixir                 = 0;
        em.totalElixir            = 0;
        em.lifetimeMoney          = 0;
        em.lifetimeSandwichesMade = 0;
        em.lifetimeBuildings      = 0;
        em.lifetimeSwipes         = 0;

        em.totalTime = 0;

        wm.sandWitchesClicked = 0;

        em.toasterVisionLevel  = 0;
        em.communalMindLevel   = 0;
        em.dexterousHandsLevel = 1;

        wm.knifeID = 0;


        em.recalculate();
    }
コード例 #14
0
    private void Start()
    {
        if (Serializer.IsDeserializing)
        {
            return;
        }
        if (Serializer.IsLoading)
        {
            return;
        }
        staticSpheres = transform.Find("StaticSpheres").gameObject;
        wheelBase     = transform.Find("WheelBase").gameObject;
        canvas        = transform.Find("Canvas").gameObject;

        menu      = transform.Find("Canvas/Menu").gameObject;
        res       = transform.Find("Canvas/Menu/Residential").gameObject.GetComponent <Image>();
        com       = transform.Find("Canvas/Menu/Commercial").gameObject.GetComponent <Image>();
        ind       = transform.Find("Canvas/Menu/Industrial").gameObject.GetComponent <Image>();
        off       = transform.Find("Canvas/Menu/Office").gameObject.GetComponent <Image>();
        indc      = transform.Find("Canvas/Menu/Component").gameObject.GetComponent <Image>();
        fol       = transform.Find("Canvas/Menu/Foliage").gameObject.GetComponent <Image>();
        serv      = transform.Find("Canvas/Menu/Service").gameObject.GetComponent <Image>();
        baseColor = fol.color;

        spawnManager               = ReferenceManager.instance.spawnManager;
        economyManager             = ReferenceManager.instance.economyManager;
        populationManager          = ReferenceManager.instance.populationManager;
        progressionManager         = ReferenceManager.instance.progressionManager;
        thumbTracker               = GetComponent <ThumbTracker>();
        events                     = GameObject.Find("LeftController").GetComponent <VRTK_ControllerEvents>();
        events.TouchpadTouchStart += DoTouchpadTouch;
        events.TouchpadPressed    += DoTouchpadPress;
        events.TouchpadTouchEnd   += DoTouchpadRelease;
        HideUI();
    }
コード例 #15
0
 // Use this for initialization
 void Start()
 {
     timePassed       = 0;
     manager          = GameObject.Find("Managers");
     economyManager   = manager.GetComponent <EconomyManager>();
     happinessManager = manager.GetComponent <HappinessManager>();
 }
コード例 #16
0
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;

            traits             = new List <Trait>(traitDataBase.GetTraitLists());
            currentPrice       = new Dictionary <Trait, float>();
            pastPrice          = new Dictionary <Trait, List <float> >();
            priceModifier      = new Dictionary <Trait, float>();
            sympathyModifier   = new Dictionary <Trait, float>();
            volatilityModifier = new Dictionary <Trait, float>();
            priceOscillation   = new Dictionary <Trait, List <bool> >();
            foreach (Trait trait in traits)
            {
                pastPrice[trait] = new List <float>();

                currentPrice[trait]       = trait.GetTraitBaseValue();
                priceModifier[trait]      = 1;
                sympathyModifier[trait]   = 1;
                volatilityModifier[trait] = 1;
            }
            GenerateOscillation();
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }
        //DontDestroyOnLoad(gameObject);
    }
コード例 #17
0
 public DestroyMonitor()
 {
     buildingManager   = Singleton <BuildingManager> .instance;
     simulationManager = Singleton <SimulationManager> .instance;
     economyManager    = Singleton <EconomyManager> .instance;
     coverageManager   = Singleton <CoverageManager> .instance;
     nullAudioGroup    = new AudioGroup(0, new SavedFloat("NOTEXISTINGELEMENT", Settings.gameSettingsFile, 0, false));
 }
コード例 #18
0
ファイル: GoldText.cs プロジェクト: Aye1/RPG-Village-Builder
    // Use this for initialization
    void Start()
    {
        _economyManager = FindObjectOfType <EconomyManager>();
        _text           = GetComponent <Text>();

        ObjectChecker.CheckNullity(_economyManager, "Economy manager not found");
        ObjectChecker.CheckNullity(_text, "Component Text not found");
    }
コード例 #19
0
 // Use this for initialization
 void Awake()
 {
     knife    = (GameObject)Instantiate(knifePrefab, new Vector3(-4f, -6f, 5f), Quaternion.identity);
     em       = GetComponent <EconomyManager>();
     wm       = GetComponent <WorldManager>();
     downTime = 0;
     //knife.transform.position = new Vector3(100f, 100f);
 }
コード例 #20
0
 public void SetScraps(int s)
 {
     if (eManager == null)
     {
         eManager = GameObject.Find("LevelManager").GetComponent <EconomyManager>();
     }
     eManager.SetScraps(s);
 }
コード例 #21
0
 public BudgetHandler(SocketRequestHandler handler) :
     base(handler, "Budget")
 {
     economyManager = EconomyManager.instance;
     server.dailyCallbacks.Register(Update);
     SendAll();
     handler.RegisterMessageHandler("Budget", OnClientMessage);
 }
コード例 #22
0
 // Use this for initialization
 void Awake()
 {
     knife = (GameObject)Instantiate(knifePrefab, new Vector3(-4f, -6f, 5f), Quaternion.identity);
     em = GetComponent<EconomyManager>();
     wm = GetComponent<WorldManager>();
     downTime = 0;
     //knife.transform.position = new Vector3(100f, 100f);
 }
コード例 #23
0
 void Awake()
 {
     if (instance != null)
     {
         Debug.LogWarning("More than one instance of EconomyManager found");
         return;
     }
     instance = this;
 }
コード例 #24
0
    // Start is called before the first frame update
    void Start()
    {
        economyManager  = this.GetComponent <EconomyManager>();
        buildingManager = this.GetComponent <BuildingManager>();

        inGameUI = UIManager.getInstance().getInGameUI();

        ActivateCombatState();
    }
コード例 #25
0
 // Start is called before the first frame update
 void Start()
 {
     if (managerObj == null)
     {
         managerObj = GameObject.Find("Manager");
         emScript   = managerObj.GetComponent <EntityManager>();
         ecoScript  = managerObj.GetComponent <EconomyManager>();
     }
 }
コード例 #26
0
    // Use this for initialization
    void Start()
    {
        _buildings      = new Dictionary <Vector3, Building>();
        _economyManager = FindObjectOfType <EconomyManager>();
        _mapInfos       = FindObjectOfType <MapInfosManager>();

        ObjectChecker.CheckNullity(_economyManager, "Economy manager not found");
        ObjectChecker.CheckNullity(_mapInfos, "Map infos not found");
    }
コード例 #27
0
 private void Start()
 {
     if (Serializer.IsLoading)
     {
         return;
     }
     displayUI      = transform.parent.transform.parent.GetComponent <DisplayUI>();
     economyManager = GameObject.Find("Managers").GetComponent <EconomyManager>();
     thumb          = transform.parent.transform.parent.GetComponent <ThumbTracker>();
 }
コード例 #28
0
        protected override void setAutobudget()
        {
            District d = Singleton <DistrictManager> .instance.m_districts.m_buffer[0];

            int capacity1 = d.GetEducation1Capacity();
            int capacity2 = d.GetEducation2Capacity();

            // No education facilities
            if (capacity1 == 0 && capacity2 == 0)
            {
                return;
            }

            int need1 = d.GetEducation1Need();
            int need2 = d.GetEducation2Need();

            //Debug.Log(string.Format("Capacity: {0}, need: {1}", capacity1, need1));

            EconomyManager    em = Singleton <EconomyManager> .instance;
            SimulationManager sm = Singleton <SimulationManager> .instance;

            int   currentBudget         = em.GetBudget(ItemClass.Service.Education, ItemClass.SubService.None, sm.m_isNightTime);
            float currentProductionRate = Helper.GetProductionRateFromBudget(currentBudget);

            // Convert to the normal capacity
            capacity1 = (int)(capacity1 / currentProductionRate + 0.5f);
            capacity2 = (int)(capacity2 / currentProductionRate + 0.5f);

            //Debug.Log(string.Format("currentBudget: {0}, currentProductionRate: {1}, normal capacity", currentBudget, currentProductionRate, capacity1));

            float targetProductionRate1 = 0.25f;

            if (capacity1 > 0 && need1 > 0)
            {
                targetProductionRate1 = need1 * (ElementaryEducationTargetRate * 0.01f) / capacity1;
            }

            float targetProductionRate2 = 0.25f;

            if (capacity2 > 0 && need2 > 0)
            {
                targetProductionRate2 = need2 * (HighEducationTargetRate * 0.01f) / capacity2;
            }

            float targetProductionRate = Math.Max(targetProductionRate1, targetProductionRate2);

            int newBudget = Helper.GetBudgetFromProductionRate(targetProductionRate);

            //Debug.Log(string.Format("targetProductionRate: {0}, newBudget: {1}", targetProductionRate, newBudget));

            newBudget = Math.Min(newBudget, BudgetMaxValue);

            setBudget(newBudget);
        }
コード例 #29
0
 /// <summary>
 /// Class initialisiation. Assigns all the links and starts autosaving if enabled.
 /// </summary>
 public void Initialise()
 {
     _timeAndCalendarLink = GameManager.Instance.ScriptHolderLink.GetComponent <TimeAndCalendar>();
     _playerManagerLink   = GameManager.Instance.SceneManagerLink.GetComponent <PlayerManager>();
     _economyManagerLink  = GameManager.Instance.SceneManagerLink.GetComponent <EconomyManager>();
     _objectManager       = GameManager.Instance.SceneManagerLink.GetComponent <ObjectManager>();
     if (autosaveOn)
     {
         AutoSaveHandler(true);
     }
 }
コード例 #30
0
ファイル: Unary.cs プロジェクト: 01010100b/AoE2Lib
        public Unary() : base()
        {
            Mod = new Mod();
            Mod.Load();

            MapManager        = new MapManager(this);
            StrategyManager   = new StrategyManager(this);
            EconomyManager    = new EconomyManager(this);
            ProductionManager = new ProductionManager(this);
            OperationsManager = new OperationsManager(this);
        }
コード例 #31
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
コード例 #32
0
 private void Initialize()
 {
     this._buildingManager = Singleton<BuildingManager>.instance;
     this._simulationManager = Singleton<SimulationManager>.instance;
     this._effectManager = Singleton<EffectManager>.instance;
     this._economyManager = Singleton<EconomyManager>.instance;
     this._coverageManager = Singleton<CoverageManager>.instance;
     this._nullAudioGroup = new AudioGroup(0, new SavedFloat("NOTEXISTINGELEMENT", Settings.gameSettingsFile, 0f, false));
 }