public void Release()
 {
     mMainUI         = null;
     mShopBackCanvas = null;
     mBackPack       = null;
     mShop           = null;
 }
示例#2
0
    void Init()
    {
        string     strPrefab = "Common/Prefab/Shop/UIShop";
        GameObject obj       = PrefabCache.main.Load(strPrefab);


        uiPrefab = obj.GetComponent <UIShop>();
    }
示例#3
0
    public void Setup(EntitiesDatabaseSO.EntityData myData, UIShop shopRef)
    {
        icon.sprite = myData.icon;
        name.text   = myData.name;
        cost.text   = myData.cost.ToString();

        this.myData  = myData;
        this.shopRef = shopRef;
    }
示例#4
0
    public override void Execute(object data)
    {
        UIShop    shop = MVC.GetView <UIShop>();
        int       id   = (int)data;
        GameModel gm   = Game.M_Instance.M_GM;

        gm.M_TakeOnSkin = id;
        shop.UpdateUI();
    }
示例#5
0
 public void SetSelectedTower(UIShop shop)
 {
     selection        = shop;
     prefab           = shop.getPrefab();
     tower            = prefab.GetComponent <Tower>();
     cost             = tower.GetPrice();
     holdTower        = true;
     selected         = true;
     towerText        = tower.GetDescription();
     description.text = towerText;
 }
示例#6
0
    static public UIShop GetInstance()
    {
        UIShop self = UIManager.Singleton.GetUIWithoutLoad <UIShop>();

        if (self != null)
        {
            return(self);
        }
        self = UIManager.Singleton.LoadUI <UIShop>("UI/UIShop", UIManager.Anchor.Center);
        return(self);
    }
示例#7
0
    public override void Execute(object data)
    {
        UIShop    shop = MVC.GetView <UIShop>();
        int       id   = (int)data;
        GameModel gm   = Game.M_Instance.M_GM;

        gm.M_TakeOnFootball = id;

        //shop.UpdateFootballBuyButton(id);
        //shop.UpdateFootballGizmo();
    }
示例#8
0
    public override void Execute(object data)
    {
        GameModel       gm   = GetModel <GameModel>();
        UIShop          shop = GetView <UIShop>();
        BuyFootballArgs e    = data as BuyFootballArgs;

        gm.TakeonFootball = e.Index;
        shop.UpdateUI();
        shop.UpdateFootballBuyBtn(e.Index);
        //更新Gizmo
        shop.UpdateFootBallGizmo();
    }
示例#9
0
    public void SetShopItem(int id, ShopItemDefine shopItem, UIShop owner)
    {
        this.shop       = owner;
        this.ShopItemID = id;
        this.ShopItem   = shopItem;
        this.item       = DataManager.Instance.Items[this.ShopItem.ItemID];

        this.title.text          = this.item.Name;
        this.count.text          = ShopItem.Count.ToString();
        this.price.text          = ShopItem.Price.ToString();
        this.icon.overrideSprite = Resloader.Load <Sprite>(item.Icon);
    }
示例#10
0
    public override void Execute(object data)
    {
        BuySkinClothFootballArgs e = data as BuySkinClothFootballArgs;
        GameModel gm   = Game.M_Instance.M_GM;
        UIShop    shop = MVC.GetView <UIShop>();

        if (gm.GetMoney(e.M_Coin))
        {
            gm.M_BuySkin.Add(e.M_ID);
            //shop.UpdateUI();
        }
    }
示例#11
0
        public void ShowShop(int shopId)
        {
            ShopDefine shop;

            if (DataManager.Instance.Shops.TryGetValue(shopId, out shop))
            {
                UIShop uiShop = UIManager.Instance.Show <UIShop>();
                if (shop != null)
                {
                    uiShop.SetShop(shop);
                }
            }
        }
示例#12
0
    public override void Execute(object data)
    {
        GameModel   gm   = GetModel <GameModel>();
        UIShop      shop = GetView <UIShop>();
        BuySkinArgs e    = data as BuySkinArgs;

        gm.TakeonSkin = e.ID;
        //更新UI
        shop.UpdateUI();
        shop.UpdateSkinBuyBtn(e.ID.SkinID);
        //更新Gizmo
        shop.UpdateSkinGizmo();
    }
示例#13
0
    public override void Execute(object data = null)
    {
        ShopArgs  e    = data as ShopArgs;
        GameModel gm   = GetModel <GameModel>();
        UIShop    shop = GetView <UIShop>();


        gm.FootballInfoList[gm.EquipeBallIndex].State = ItemState.Buy; //把之前装备的更改为已购买


        gm.FootballInfoList[e.index].State = e.state;
        gm.ShotQulity = Game.Instance.Data.GetFootballData(e.index).skillAdd;

        shop.UpdateUI();
    }
示例#14
0
    public override void Execute(object data = null)
    {
        ShopArgs  e    = data as ShopArgs;
        GameModel gm   = GetModel <GameModel>();
        UIShop    shop = GetView <UIShop>();


        gm.HeadInfoList[gm.EquipeHeadIndex].State = ItemState.Buy;


        gm.HeadInfoList[e.index].State = e.state;
        gm.SkillTime = Game.Instance.Data.GetHeadData(e.index).skillAdd;

        shop.UpdateUI();
    }
示例#15
0
    public override void Execute(object data = null)
    {
        ShopArgs  e    = data as ShopArgs;
        UIShop    shop = GetView <UIShop>();
        GameModel gm   = GetModel <GameModel>();

        if (gm.GetMoney(e.coin))
        {
            gm.FootballInfoList[e.index].State = e.state;
            shop.UpdateUI();
        }
        else
        {
            shop.TipMessage("金币不足!");
        }
    }
示例#16
0
    void OnDestroy()
    {
        instance  = null;
        rootPanel = null;

        lobbyPanelPathArray = null;

        uiLobby      = null;
        uiMessageBox = null;
        uiGameReady  = null;
        uiHeroList   = null;
        uiTowerList  = null;
        uiWaiting    = null;
        uiBaseInfo   = null;
        uiGameOption = null;
        uiShop       = null;
    }
示例#17
0
    public void AltSetup(EntitiesDatabaseSO.EntityData myData, DeckManager deckref)
    {
        icon.sprite = myData.icon;
        name.text   = myData.name;
        cost.text   = myData.cost.ToString();
        damage.text = myData.damage.ToString();
        health.text = myData.health.ToString();
        //movement.text = myData.movement.ToString();

        if (myData.name.Equals("Tiger"))
        {
            Sprite nimble = Resources.Load <Sprite>("nimble");
            Sprite runner = Resources.Load <Sprite>("runner");
            abilityicon.GetComponent <Image>().sprite  = nimble;
            abilityicon2.GetComponent <Image>().sprite = runner;
        }
        else if (myData.name.Equals("Peasant"))
        {
            Sprite builder = Resources.Load <Sprite>("builder");
            abilityicon.GetComponent <Image>().sprite = builder;
            abilityicon2.enabled = false;
        }
        else if (myData.name.Equals("Avenger"))
        {
            Sprite builder = Resources.Load <Sprite>("builder");
            abilityicon.GetComponent <Image>().sprite = builder;
            abilityicon2.enabled = false;
        }
        else if (myData.movement == 2)
        {
            Sprite runner = Resources.Load <Sprite>("runner");
            abilityicon.GetComponent <Image>().sprite = runner;
            abilityicon2.enabled = false;
        }
        else
        {
            abilityicon.enabled  = false;
            abilityicon2.enabled = false;
        }

        this.myData         = myData;
        this.shopRef        = null;
        this.deckmanagerRef = deckref;
    }
 public void GetSceneUI()
 {
     if (!mMainUI)
     {
         mMainUI = GameObject.Find("UI").transform.GetChild(0).gameObject;
     }
     if (!mShopBackCanvas)
     {
         if (!mMainUI.transform.GetChild(0))
         {
             return;
         }
         mShopBackCanvas = mMainUI.transform.GetChild(0).gameObject;
         if (!mShopBackCanvas.GetComponent <UIBackPack>() || !mShopBackCanvas.GetComponent <UIShop>())
         {
             return;
         }
         mBackPack = mShopBackCanvas.GetComponent <UIBackPack>();
         mShop     = mShopBackCanvas.GetComponent <UIShop>();
     }
 }
示例#19
0
    public override void Execute(object data)
    {
        GameModel       gm   = GetModel <GameModel>();
        UIShop          shop = GetView <UIShop>();
        BuyFootballArgs e    = data as BuyFootballArgs;

        if (gm.PayCoin(e.Coin))
        {
            //把当前id加入已购买列表
            gm.BuyFootball.Add(e.Index);
            foreach (var item in gm.BuyFootball)
            {
                Debug.Log("买了" + item + "号");
            }
            //更新UI
            shop.UpdateUI();
            shop.UpdateFootballBuyBtn(e.Index);
            //更新GIzmo
            shop.UpdateFootBallGizmo();
        }
    }
示例#20
0
    public override void Execute(object data)
    {
        GameModel   gm   = GetModel <GameModel>();
        UIShop      shop = GetView <UIShop>();
        BuySkinArgs e    = data as BuySkinArgs;

        if (gm.PayCoin(e.Coin))
        {
            //把当前id加入已购买列表
            gm.BuySkin.Add(e.ID);
            foreach (var item in gm.BuySkin)
            {
                Debug.Log("买了" + item.SkinID + "号皮肤" + item.ClothID + "号衣服");
            }
            //更新UI
            shop.UpdateUI();
            shop.UpdateClothBuyBtn(e.ID.ClothID);

            //更新GIzmo
            shop.UpdateClothGizmo();
        }
    }
示例#21
0
 void EndGachaAndShowShopPanel()
 {
     UIShop.GetInstance().ShowWindow();
     UIShop.GetInstance().ShowRecruitment();
 }
示例#22
0
        public override void CreateUI()
        {
            //Add background gif:
            AddUIElement(new UIBackgroundAnimation(
                             new Transform(Alignment.MiddleCenter, new Vector2(GameUIController.WindowWidth, GameUIController.WindowHeight)),
                             Random.Next(2) == 0 ? ContentHelper.Citadel_Background_Animation_1 : ContentHelper.Citadel_Background_Animation_2,
                             this
                             ));

            //Add the shop:
            uiShop = AddUIElement(new UIShop(
                                      new Transform(Alignment.MiddleCenter, new Vector2(1300, 800)),
                                      this
                                      ));

            uiShop.Visable = false; //Hide the shop.

            //Add the shipyard:
            uiShipyard = AddUIElement(new UIShipyard(
                                          new Transform(Alignment.MiddleCenter, new Vector2(1200, 800)),
                                          this
                                          ));

            uiShipyard.Visable = false; //Hide the shipyard.

            uiSaveFiles = AddUIElement(new UISaveFiles(
                                           new Transform(Alignment.MiddleCenter, new Vector2(250, 600)),
                                           this,
                                           true,
                                           "Save & Load",
                                           new EventArg0(ToggleUISaveFiles)
                                           ));

            uiSaveFiles.Visable = false;

            //Go back button:
            AddUIElement(new UIButton(
                             new Transform(Alignment.BottomLeft, new Vector2(300, 50)),
                             ContentHelper.Arial_Font,
                             "Exit the Citadel",
                             TextAlign.MiddleCenter,
                             5,
                             ContentHelper.Box4x4_Sprite,
                             new EventArg1 <EventArg>(GameUIController.CreateGalaxyScreen, null),
                             this
                             )).SetColor(new Color(28, 28, 28));

            //Open shipyard button:
            AddUIElement(new UIButton(
                             new Transform(Alignment.BottomRight, new Vector2(200, 50)),
                             ContentHelper.Arial_Font,
                             "Shipyard",
                             TextAlign.MiddleCenter,
                             5,
                             ContentHelper.Box4x4_Sprite,
                             new EventArg0(ToggleUIShipyard),
                             this
                             )).SetColor(new Color(28, 28, 28));

            //Open shop button:
            AddUIElement(new UIButton(
                             new Transform(Transform.CreatePosition(Alignment.BottomRight, new Vector2(-212.5f, 0), new Vector2(200, 50)), new Vector2(200, 50)),
                             ContentHelper.Arial_Font,
                             "Shop",
                             TextAlign.MiddleCenter,
                             5,
                             ContentHelper.Box4x4_Sprite,
                             new EventArg0(ToggleUIShop),
                             this
                             )).SetColor(new Color(28, 28, 28));

            //Open save files:
            AddUIElement(new UIButton(
                             new Transform(Transform.CreatePosition(Alignment.BottomRight, new Vector2(-425, 0), new Vector2(200, 50)), new Vector2(200, 50)),
                             ContentHelper.Arial_Font,
                             "Save & Load",
                             TextAlign.MiddleCenter,
                             5,
                             ContentHelper.Box4x4_Sprite,
                             new EventArg0(ToggleUISaveFiles),
                             this
                             )).SetColor(new Color(28, 28, 28));

            //Add the Top Info bar:
            AddUIElement(new UITopInfo(this));
        }
示例#23
0
 public void CreateUI()
 {
     ui = (UIShop)GameObject.Instantiate(uiPrefab);
     ui.SetController(this);
     UIViewController.ClonePrefabRectTransform(uiPrefab.gameObject, ui.gameObject);
 }
示例#24
0
文件: UIShop.cs 项目: bradur/LD44
 void Awake()
 {
     main = this;
 }
示例#25
0
    public override IEnumerator Run()
    {
        if ("Dungeon" == SceneManager.GetActiveScene().name)
        {
            AsyncOperation operation = SceneManager.LoadSceneAsync("Common", LoadSceneMode.Additive);
            while (false == operation.isDone)
            {
                // loading progress
                yield return(null);
            }
            yield return(StartCoroutine(GameManager.Instance.Init()));
        }

        log = UIUtil.FindChild <UILog>(transform, "UI/UILog");
        log.gameObject.SetActive(true);

        dungeon = UIUtil.FindChild <Dungeon>(transform, "Dungeon");
        dungeon.gameObject.SetActive(true);
        dungeon_move = UIUtil.FindChild <DungeonMove>(transform, "Dungeon");

        battle = UIUtil.FindChild <DungeonBattle>(transform, "Battle");
        battle.gameObject.SetActive(false);

        ui_inventory = UIUtil.FindChild <UIInventory>(transform, "UI/UIInventory");
        ui_inventory.gameObject.SetActive(false);
        ui_inventory.Init();

        inventory_button = UIUtil.FindChild <Button>(transform, "UI/Dungeon/SideButtons/InventoryButton");
        inventory_button.onClick.AddListener(() =>
        {
            ui_inventory.gameObject.SetActive(true);
            Util.EventSystem.Publish(EventID.Dungeon_Monster_Reveal);
        });

        text_inventory = UIUtil.FindChild <Text>(transform, "UI/Dungeon/SideButtons/InventoryButton/Text");

        mini_map = UIUtil.FindChild <UIMiniMap>(transform, "UI/Dungeon/MiniMap");
        mini_map.gameObject.SetActive(true);

        ui_player_transform = UIUtil.FindChild <Transform>(transform, "UI/Player");
        ui_player_transform.gameObject.SetActive(true);
        player_health = UIUtil.FindChild <UIGaugeBar>(ui_player_transform, "Health");
        player_exp    = UIUtil.FindChild <UIGaugeBar>(ui_player_transform, "Exp");

        ui_coin = UIUtil.FindChild <UICoin>(transform, "UI/Dungeon/UICoin");
        ui_coin.gameObject.SetActive(true);
        {
            Image image = UIUtil.FindChild <Image>(ui_coin.transform, "Image");
            ui_coin_position = Camera.main.ScreenToWorldPoint(
                new Vector3(image.rectTransform.position.x, image.rectTransform.position.y, Camera.main.transform.position.z * -1.0f)
                );
        }


        coin_spot = UIUtil.FindChild <Transform>(transform, "CoinSpot");
        coin_spot.gameObject.SetActive(true);
        coin_prefab = UIUtil.FindChild <Coin>(transform, "Prefabs/Coin");

        shop = UIUtil.FindChild <UIShop>(transform, "UI/UIShop");

        Util.EventSystem.Subscribe <int>(EventID.Dungeon_Move, OnMove);
        Util.EventSystem.Subscribe(EventID.Dungeon_Exit_Unlock, () => { StartCoroutine(OnExitUnlock()); });
        Util.EventSystem.Subscribe(EventID.Dungeon_Map_Reveal, () => { mini_map.RevealMap(); });
        Util.EventSystem.Subscribe(EventID.Dungeon_Monster_Reveal, () => { mini_map.RevealMonster(); });
        Util.EventSystem.Subscribe(EventID.Dungeon_Treasure_Reveal, () => { mini_map.RevealTreasure(); });
        Util.EventSystem.Subscribe <Item>(EventID.Inventory_Add, OnItemAdd);
        Util.EventSystem.Subscribe <Item>(EventID.Inventory_Remove, OnItemRemove);
        Util.EventSystem.Subscribe(EventID.Player_Stat_Change, OnPlayerStatChange);
        Util.EventSystem.Subscribe <Quest>(EventID.Quest_Start, OnQuestStart);
        Util.EventSystem.Subscribe <Quest>(EventID.Quest_Complete, OnQuestComplete);
        AudioManager.Instance.Play(AudioManager.DUNGEON_BGM, true);

        InitScene();
    }
示例#26
0
    private void LoadUICompleteCB(GameObject gameObj, System.Guid uid, params object[] param)
    {
        if (gameObj != null)
        {
            GameObject createObj = Instantiate(gameObj) as GameObject;

            createObj.transform.parent        = rootPanel.transform;
            createObj.transform.localPosition = Vector3.zero;
            createObj.transform.localScale    = gameObj.transform.localScale;

            switch ((eUIType)param[0])
            {
            case eUIType.Type_Lobby:
                uiLobby = createObj.GetComponent <UILobby>();
                break;

            case eUIType.Type_MessageBox:
                uiMessageBox = createObj.GetComponent <UIMessageBox>();
                break;

            case eUIType.Type_GameReady:
                uiGameReady = createObj.GetComponent <UIGameReady>();
                if (param.Length > 1 && (bool)param[1])
                {
                    uiGameReady.OpenFrame();
                }
                break;

            case eUIType.Type_Hero:
                uiHeroList = createObj.GetComponent <UIHeroList>();
                if (param.Length > 1 && (bool)param[1])
                {
                    uiHeroList.OpenFrame();
                }
                break;

            case eUIType.Type_Tower:
                uiTowerList = createObj.GetComponent <UITowerList>();
                if (param.Length > 1 && (bool)param[1])
                {
                    uiTowerList.OpenFrame();
                }
                break;

            case eUIType.Type_Waiting:
                uiWaiting = createObj.GetComponent <UIWaiting>();
                break;

            case eUIType.Type_Base:
                uiBaseInfo = createObj.GetComponent <UIBaseInfo>();
                if (param.Length > 1 && (bool)param[1])
                {
                    uiBaseInfo.OpenFrame();
                }
                break;

            case eUIType.Type_Option:
                uiGameOption = createObj.GetComponent <UIGameOption>();
                if (param.Length > 1 && (bool)param[1])
                {
                    uiGameOption.OpenFrame();
                }
                break;

            case eUIType.Type_Shop:
                uiShop = createObj.GetComponent <UIShop>();
                if (param.Length > 1 && (bool)param[1])
                {
                    uiShop.OpenFrame();
                }
                break;
            }
        }
    }
示例#27
0
文件: UIShop.cs 项目: TimonYoon/Dev
 private void Awake()
 {
     Instance = this;
 }
示例#28
0
 public UIShop()
 {
     instance = this;
 }