public void ShowWeapon(string name)
 {
     this.weaponName     = name;
     this.weaponLoader   = MenuWeaponLoader.GetLoader(name);
     this.titleText.text = this.weaponName.ToUpper();
     gunImg.sprite       = this.weaponLoader.gunSprite;
     gunImg.SetNativeSize();
 }
Example #2
0
        public static MenuWeaponLoader GetLoader(string name)
        {
            if (loaders.ContainsKey(name))
            {
                return(loaders[name]);
            }
            MenuWeaponLoader newLoader = new MenuWeaponLoader();

            newLoader.weaponInstance = Instantiate(PrefabResources.Get("Weapon/" + name).gameObject);
            newLoader.originPos      = newLoader.weaponInstance.transform.localPosition;
            newLoader.weaponInstance.SetActive(false);
            newLoader.gunSprite = Resources.Load("Textures/" + name, typeof(Sprite)) as Sprite;
            Debug.Log(newLoader.gunSprite.name);
            loaders[name] = newLoader;
            return(newLoader);
        }
Example #3
0
        private void Awake()
        {
            INSTANCE = this;
            Profile.LoadAll();

            mCameraController     = GetComponent <MenuCameraController>();
            mTopBar               = Find <MenuTopBar>("TopBar");
            mBottomBar            = Find <MenuBottomBar>("BottomBar");
            mMain                 = Find <MenuMain>("MainPanel");
            mMain.showEndDelegate = (Action <MenuAbs>)Delegate.Combine(mMain.showEndDelegate, new Action <MenuAbs>(this.MenuShowEnd));
            //mDailyReward = Find<MenuDailyReward>("DailyRewardPanel");
            mMail       = Find <MenuMail>("MailPanel");
            mShop       = Find <MenuShop>("ShopPanel");
            mAchivement = Find <MenuAchivement>("AchivementPanel");
            mSetting    = Find <MenuSetting>("SettingPanel");
            mFirstPage  = Find <MenuFirstPage>("FirstPanel");
            mFirstPage.showEndDelegate = (Action <MenuAbs>)Delegate.Combine(mFirstPage.showEndDelegate, new Action <MenuAbs>(this.MenuShowEnd));
            mMission = Find <MenuMission>("MissionPanel");
            mMission.showEndDelegate = (Action <MenuAbs>)Delegate.Combine(mMission.showEndDelegate, new Action <MenuAbs>(this.MenuShowEnd));
            mOverlay = Find <MenuOverlay>("OverlayPanel");
            // 清空才能再次加载,否则对象存在,对象里的实例已经被销毁
            MenuWeaponLoader.ClearLoaders();
        }