Пример #1
0
 // Use this for initialization
 void Start()
 {
     shopManager = Gamemanager.main.GetComponent <ShopSystem>();
     GetComponent <Text>().text = itemName;
     originColor = this.GetComponent <Text>().color;
     checkIfLimit();
 }
Пример #2
0
    private void OnMouseOver()
    {
        if (EventSystem.current.IsPointerOverGameObject() || !canBeBuild)
        {
            return;
        }

        if (GameManager.Instance.toolToBuild != null && currentObject == null)
        {
            spr.color = targetColor;

            // build
            if (Input.GetMouseButtonDown(0))
            {
                if (ShopSystem.CanBuild())
                {
                    PlaceTool();
                }
                else
                {
                    shake.CameraShake();
                    // Show not enought money UI
                    shake.ShowNotEnoughMoney();
                    // sound
                    AudioManager.Play(Sound.MoneyNotEnoughSound);
                }
            }
            else
            {
                return;
            }
        }
        return;
    }
Пример #3
0
        private static void Prefix(ShopSystem __instance, bool actor, int typ, ref Dictionary <int, int> ___shopItems)
        {
            if (!Main.enabled || DateFile.instance.itemSortLists.Count == 0)
            {
                return;
            }

            var df = DateFile.instance;

            IOrderedEnumerable <KeyValuePair <int, int> > val = null;

            if (Main.settings.isdesc == true)
            {
                val = ___shopItems.OrderByDescending(kv => int.Parse(df.GetItemDate(kv.Key, 999, true))).OrderByDescending(kv => (10000 * int.Parse(df.GetItemDate(kv.Key, Main.sorttypes[df.itemSortLists[0]], true))
                                                                                                                                  + int.Parse(df.GetItemDate(kv.Key, Main.sorttypes[df.itemSortLists[1]], true))));
            }
            else
            {
                val = ___shopItems.OrderBy(kv => int.Parse(df.GetItemDate(kv.Key, 999, true))).OrderBy(kv => (10000 * int.Parse(df.GetItemDate(kv.Key, Main.sorttypes[df.itemSortLists[0]], true))
                                                                                                              + int.Parse(df.GetItemDate(kv.Key, Main.sorttypes[df.itemSortLists[1]], true))));
            }


            ___shopItems = val.ToDictionary((KeyValuePair <int, int> o) => o.Key, (KeyValuePair <int, int> p) => p.Value);
            return;
        }
Пример #4
0
 // 隐藏低品级商品
 // *** 在这个地方改,会导致交易之后隐藏的商品真的消失 ***
 // 应该在 ShopSystem::SetItems 方法的 actor == false 的流程中的 MakeItem 方法调用时过滤,但是太麻烦了,暂时不想改
 private static void Postfix(ref ShopSystem __instance)
 {
     if (Main.settings.hideLowQuality)
     {
         __instance.shopItems = Merchandise.FilterLowQualityItems(__instance.shopItems);
     }
 }
    void OnGUI()
    {
        EditorGUILayout.LabelField("Shop");
        Shop = EditorGUILayout.ObjectField(Shop, typeof(ShopSystem), true) as ShopSystem;

        EditorGUILayout.LabelField("Shop Browser Window");
        BrowserWindow = EditorGUILayout.ObjectField(BrowserWindow, typeof(Transform), true) as Transform;

        if (Shop != null && BrowserWindow != null)
        {
            Furniture item = ItemPrefab.GetComponent <Furniture>();
            EditorGUILayout.LabelField("");
            item.Name = EditorGUILayout.TextField("Name", item.Name);
            if (item.Name != null && item.Name != "")
            {
                item.Description     = EditorGUILayout.TextField("Description", item.Description);
                item.Price           = EditorGUILayout.FloatField("Price", item.Price);
                item.OneTimePurchase = EditorGUILayout.Toggle("One Time Purchase", item.OneTimePurchase);

                EditorGUILayout.LabelField("Button Sprite");
                ItemButton.GetComponent <Image>().sprite = EditorGUILayout.ObjectField(ItemButton.GetComponent <Image>().sprite, typeof(Sprite), true) as Sprite;
                EditorGUILayout.LabelField("Item Sprite");
                ItemPrefab.GetComponent <Image>().sprite = EditorGUILayout.ObjectField(ItemPrefab.GetComponent <Image>().sprite, typeof(Sprite), true) as Sprite;

                item.ProductImage = ItemPrefab.GetComponent <Image>().sprite;

                item.PurchaseSound = EditorGUILayout.TextField("Purchase Sound", item.PurchaseSound);

                if (GUILayout.Button("Create Item"))
                {
                    CreateItem();
                }
            }
        }
    }
Пример #6
0
 // Start is called before the first frame update
 void Start()
 {
     menu       = GameObject.Find("UI_Shop");
     shopSystem = menu.GetComponent <ShopSystem>();
     anim       = GetComponent <Animator>();
     AIMove     = GetComponent <AIMovement>();
 }
Пример #7
0
 private static void Postfix(ShopSystem __instance)
 {
     if (!Main.on)
     {
         return;
     }
     Utils.ButtonConfirm(__instance.shopOkButton);
 }
Пример #8
0
 private void Awake()
 {
     moneyManager  = FindObjectOfType <MoneyManager>();
     waveSpawner   = FindObjectOfType <WaveSpawner>();
     shop          = FindObjectOfType <ShopSystem>();
     input         = FindObjectOfType <StrategyInput>();
     BuildAction   = Build;
     shop.OnBuild += BuildAction;
 }
Пример #9
0
    private static void AfterSceneLoad()
    {
        // Initialize basic game systems.
        var userInterfaceSystem = new UserInterfaceSystem();
        var controlSystem       = new ControlSystem(resourcesData.gameplaySettings);
        var keysSystem          = new KeysSystem(resourcesData.stagePrefabs);
        var stageSystem         = new StageSystem(resourcesData.stagePrefabs, keysSystem);
        var ballSystem          = new BallSystem(resourcesData.ballPrefabs, stageSystem);
        var gameCurrencySystem  = new GameCurrencySystem(userInterfaceSystem);
        var monetizationSystem  = new MonetizationSystem(resourcesData.monetizationSettings, gameCurrencySystem);
        var shopSystem          = new ShopSystem(resourcesData.shopModel, ballSystem, gameCurrencySystem, monetizationSystem);

        // Initialize gameplay systems.
        var gameInteractionsSystem = new GameInteractionsSystem(ballSystem, keysSystem, stageSystem);
        var gameInterfaceSystem    = new GameInterfaceSystem(stageSystem, gameInteractionsSystem);

        // Register a proxy service for gameplay systems.
        var gameplaySystemsProxy = new GameplaySystemsProxy();

        gameplaySystemsProxy.Add(
            gameInteractionsSystem,
            gameInterfaceSystem);

        // Initialize the state machine system with all dependencies.
        var gameStateMachine = new GameStateMachine(
            gameplaySystemsProxy,
            userInterfaceSystem,
            controlSystem,
            stageSystem,
            ballSystem,
            keysSystem,
            gameCurrencySystem,
            monetizationSystem);

        // Preserve links to game services.
        var storage = new GameObject("[Game Services]").AddComponent <GameServices>();

        storage.Add(
            userInterfaceSystem,
            controlSystem,
            keysSystem,
            stageSystem,
            ballSystem,
            gameCurrencySystem,
            monetizationSystem,
            shopSystem);
        storage.Add(
            gameplaySystemsProxy,
            gameStateMachine);

        // Free the static reference to resources data - it's held by services from now.
        resourcesData = null;

        // Since there is only one scene in the project, we just link this very bootstrap script to the event of reloading scene.
        SceneManager.sceneLoaded += RebootOnNextSceneLoaded;
    }
Пример #10
0
    private void Awake()
    {
        day += 0.375f;

        shopScript  = UI.GetComponent <ShopSystem>();
        currentGoal = level1Goal;

        hourHand   = Clock.transform.Find("hourHand");
        minuteHand = Clock.transform.Find("minuteHand");
    }
 void Start()
 {
     none = Resources.Load <Sprite>("Item/Image/none");
     if (!Instance)
     {
         Instance = this;
     }
     btnPreviousPage.GetComponent <Button>().onClick.AddListener(PreviousPage);
     btnNextPage.GetComponent <Button>().onClick.AddListener(NextPage);
 }
Пример #12
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(this.gameObject);
     }
 }
Пример #13
0
    public override void Start()
    {
        base.Start();
        shop    = FindObjectOfType <ShopSystem>();
        factory = GetComponent <UnitFactory>();

        /*defaultObjective = new GameObject().transform;
         * defaultObjective.transform.position = transform.position + transform.forward * spawnDistance * 3;*/
        startPosition         = transform.position + transform.forward * spawnDistance;
        CreateUnitAction      = CreateUnit;
        UpgradeBarracksAction = UpgradeBarracks;
    }
Пример #14
0
 static public int BuyItemToSystem(IntPtr l)
 {
     try {
         ShopSystem self = (ShopSystem)checkSelf(l);
         self.BuyItemToSystem();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Пример #15
0
 static public int constructor(IntPtr l)
 {
     try {
         ShopSystem o;
         o = new ShopSystem();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Пример #16
0
    private void Update()
    {
        if (SceneManager.GetActiveScene().buildIndex == 1)
        {
            shopSystem = GameObject.Find("CannonsContainer").GetComponent <ShopSystem>();
            if (shopSystem.isBought == true)
            {
                gameController.isBought = true;

                shopSystem.isBought = false;
            }
        }
    }
Пример #17
0
 static public int GetBuyRet(IntPtr l)
 {
     try {
         ShopSystem self = (ShopSystem)checkSelf(l);
         var        ret  = self.GetBuyRet();
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Пример #18
0
        private static void Postfix(ShopSystem __instance)
        {
            if (!Main.enabled && Main.binding_key)
            {
                return;
            }
            EscClose newobj = __instance.gameObject.AddComponent(typeof(EscClose)) as EscClose;

            newobj.setparam(typeof(ShopSystem), "CloseShopWindow", () =>
            {
                return(ShopSystem.instance.shopWindow.activeInHierarchy);
            });
        }
Пример #19
0
    private void Awake()
    {
        DAY_IN_SECONDS = (COUNTDOWN_TIMER * 2);
        day           += 0.375f;

        shopScript   = UI.GetComponent <ShopSystem>();
        currentGoal  = level1Goal;
        Panel        = UI.transform.Find("Panel");
        hourHand     = Clock.transform.Find("hourHand");
        minuteHand   = Clock.transform.Find("minuteHand");
        clockTime    = Clock.transform.Find("clockTime").GetComponent <TextMeshProUGUI>();
        LevelCounter = Panel.Find("currentLevel");
    }
Пример #20
0
 static public int SetShowList(IntPtr l)
 {
     try {
         ShopSystem self = (ShopSystem)checkSelf(l);
         System.Collections.Generic.List <Groot.Network.SaleItem> a1;
         checkType(l, 2, out a1);
         self.SetShowList(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Пример #21
0
    // Start is called before the first frame update
    void Start()
    {
        if (Instance != null && Instance != this)
        {
            Destroy(gameObject);
        }
        else
        {
            Instance = this;
        }

        itemdatabase = ItemDatabase.Instance;
        inventory    = InventoryController.Instance;
        playersystem = PlayerSystem.Instance;
    }
Пример #22
0
        private static bool Prefix(int shopTyp, int moneyCost, int levelAdd, int isTaiWu, int shopActorId,
                                   ref ShopSystem __instance, ref int ___actorShopId, ref int ___shopSystemTyp, ref int ___showLevelAdd,
                                   ref int ___newShopLevel, ref int ___shopSellCost, ref int ___shopSystemCost)
        {
            if (!Main.enabled)
            {
                return(true);
            }

            SetShopItems(shopTyp, moneyCost, levelAdd, isTaiWu, shopActorId,
                         ref __instance, ref ___actorShopId, ref ___shopSystemTyp, ref ___showLevelAdd,
                         ref ___newShopLevel, ref ___shopSellCost, ref ___shopSystemCost);

            return(false);
        }
    private void OnLevelLoaded(Scene scene, LoadSceneMode loadMode)
    {
        if (scene.buildIndex == 0)
        {
            Destroy(gameObject);
        }

        if (scene.buildIndex == 1)
        {
            Time.timeScale   = 1;
            PauseMenu.paused = false;

            ShopSystem.UpdateHUBEnvironment();
        }
    }
Пример #24
0
 static public int GetSaleItemAttr(IntPtr l)
 {
     try {
         ShopSystem   self = (ShopSystem)checkSelf(l);
         System.Int32 a1;
         checkType(l, 2, out a1);
         var ret = self.GetSaleItemAttr(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Пример #25
0
 static public int BuyItemtoSystem(IntPtr l)
 {
     try {
         ShopSystem    self = (ShopSystem)checkSelf(l);
         System.UInt64 a1;
         checkType(l, 2, out a1);
         System.UInt32 a2;
         checkType(l, 3, out a2);
         self.BuyItemtoSystem(a1, a2);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Пример #26
0
    void Start()
    {
        shop             = ShopSystem.Instance;
        shopUIController = ShopUIController.Instance;

        // Debug.Log("--------IMPORTANT SHOP IS ");
        // Debug.Log(shop);

        sell1.interactable    = true;
        sell10.interactable   = false;
        sell100.interactable  = false;
        sell1000.interactable = false;
        sellAll.interactable  = true;
        // Debug.Log("shop UI Controller is ");
        // Debug.Log(shopUIController);
    }
Пример #27
0
        private static void Prefix(ShopSystem __instance, bool actor, int typ, ref Dictionary <int, int> ___shopItems)
        {
            if (!Main.enabled)
            {
                return;
            }

            ___shopItems = ___shopItems.OrderBy(o =>
                                                (int.Parse(DateFile.instance.GetItemDate(o.Key, Main.settings.getmaincate(), true)) * 10000
                                                 + int.Parse(DateFile.instance.GetItemDate(o.Key, Main.settings.getsubcate(), true)))
                                                ).ToDictionary((KeyValuePair <int, int> o) => o.Key, (KeyValuePair <int, int> p) => p.Value);



            return;
        }
    public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        shop = animator.transform.parent.parent.parent.GetComponent <ShopSystem>();

        for (int i = 1; i <= shop.skinButtons.Length; i++)
        {
            if (i == shop.skinN)
            {
                shop.skinPrice.text = shop.skin[i].cost.ToString();
                shop.skinPreviews[i - 1].SetActive(true);
                if (gameMaster.haveSkin[i])
                {
                    shop.skinPrice.text = "Sold Out!";
                }
                Debug.Log("Updated price.");
            }
            else
            {
                shop.skinPreviews[i - 1].SetActive(false);
            }
        }
    }
Пример #29
0
        private static void Postfix(ShopSystem __instance)
        {
            if (!Main.enabled || Main.binding_key)
            {
                return;
            }

            var comp = __instance.shopWindow.AddComponent <ConfirmComponent>();

            comp.SetActionOnConfirm(() =>
            {
                if (!ShopSystem.instance.shopWindow.activeInHierarchy)
                {
                    return;
                }
                if (!ShopSystem.instance.shopOkButton.interactable)
                {
                    return;
                }
                DateFile.instance.PlayeSE(2);
                ShopSystem.instance.ShopOK();
            });
        }
Пример #30
0
    public void AddUnitInInventory(UnitDescription unit, bool addToGUINow = false)
    {
        UnitDescription equivalentUnit = GetEquivalentUnit(unit);

        if (equivalentUnit == null)
        {
            if (unitsInInventory.Count >= maxElements)
            {
                Player.instance.Wallet.Earn(ShopSystem.GetUnitSellPrice(unit));
                return;
            }

            unitsInInventory.Add(unit.GetId(), unit);

            if (addToGUINow)
            {
                inventoryUI.PutInEmptySlot(unit);
            }

            return;
        }

        equivalentUnit.EarnExperience(3);
    }