Ejemplo n.º 1
0
        private BottomBar CreateBottomBar(IEnumerable <Page> pageIntents)
        {
            var bar = new BottomBar(Context);

            // TODO: Configure the bottom bar here according to your needs

            bar.SetOnTabClickListener(this);
            bar.UseFixedMode();
            bar.NoTabletGoodness();
            bar.NoTopOffset();
            PopulateBottomBarItems(bar, pageIntents);

            bar.ItemContainer.SetBackgroundColor(Xamarin.Forms.Color.FromHex("#fafafa").ToAndroid());

            //bar.SetTextAppearance(
            //    Device.Idiom == TargetIdiom.Phone ? Resource.Style.TextAppearance_Small : Resource.Style.TextAppearance_Small_ForTablet
            //);
            for (int i = 0; i < bar.ItemContainer.ChildCount; i++)
            {
                var child = bar.ItemContainer.GetChildAt(i);
                child.SetPadding(0, 0, 0, 0);
            }

            return(bar);
        }
Ejemplo n.º 2
0
        private void ClearElement()
        {
            if (Element != null)
            {
                foreach (var elementChild in Element.Children)
                {
                    var rendererChild = Platform.GetRenderer(elementChild);
                    rendererChild?.View?.RemoveFromParent();
                    Platform.SetRenderer(elementChild, null);
                }
                if (_currentPage != null)
                {
                    IVisualElementRenderer renderer = Platform.GetRenderer(_currentPage);

                    if (renderer != null)
                    {
                        renderer.View?.RemoveFromParent();
                        _currentPage = null;
                    }
                }

                if (_bottomBar != null)
                {
                    _bottomBar.RemoveFromParent();
                    _bottomBar.Dispose();
                    _bottomBar = null;
                }
            }
        }
Ejemplo n.º 3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_main);

            _bottomBar = BottomBar.Attach(this, savedInstanceState);
            _bottomBar.SetItems(Resource.Menu.menu_bottombar);
            _bottomBar.SetOnMenuTabClickListener(this);

            Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(toolbar);


            if (_credentialsService.DoCredentialsExist())
            {
                //Load stored credentials from AccountManager
                Account account = _credentialsService.LoadStoredCredentials();
            }
            else
            {
                //No credentials stored, user must log in
                var intent = new Intent(this, typeof(LogInActivity));
                StartActivity(intent);
                Finish();
            }

            if (Perscript == null)
            {
                Perscript       = PerscriptionListing._TestPerscriptions;
                endposPerscript = Perscript.Length;
            }
        }
Ejemplo n.º 4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            handler = new Handler();

            toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);
            toolbar.SetNavigationIcon(Resource.Drawable.search_dark_24dp);
            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            toolbar.SetNavigationOnClickListener(this);

            searchView           = FindViewById <SearchView>(Resource.Id.searchView);
            searchView.Focusable = false;
            searchView.SetIconifiedByDefault(true);
            searchView.OnActionViewExpanded();
            searchView.SetOnQueryTextListener(this);

            var searchAutoComplete = (SearchView.SearchAutoComplete)searchView.FindViewById(Resource.Id.search_src_text);

            searchAutoComplete.SetTextColor(GetColorStateList(Resource.Color.title_color));
            searchAutoComplete.SetTextSize(Android.Util.ComplexUnitType.Sp, 14);
            searchAutoComplete.SetHintTextColor(GetColorStateList(Resource.Color.subtitle_color));
            searchAutoComplete.OnFocusChangeListener = this;

            StatusBarCompat.SetOrdinaryToolBar(this);

            bottomBar = BottomBar.AttachShy(FindViewById <CoordinatorLayout>(Resource.Id.coordinatorLayout), FindViewById(Resource.Id.frameContent), savedInstanceState);

            bottomBar.UseFixedMode();
            bottomBar.SetItems(Resource.Menu.bottombar_menu);
            bottomBar.SetOnTabClickListener(this);
        }
Ejemplo n.º 5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            fragmentRecipesCategories = new FragmentRecipesCategories();
            fragmentTopRecipes        = new FragmentTopRecipes();
            fragmentIngredients       = new FragmentIngredients();
            SupportFragmentManager.BeginTransaction().Add(Resource.Id.fragmentContainer, fragmentRecipesCategories, "RecipesCategories").Commit();
            currentFragment = fragmentRecipesCategories;
            SupportFragmentManager.BeginTransaction().Add(Resource.Id.fragmentContainer, fragmentTopRecipes, "TOP").Hide(fragmentTopRecipes).Commit();
            SupportFragmentManager.BeginTransaction().Add(Resource.Id.fragmentContainer, fragmentIngredients, "Ingredients").Hide(fragmentIngredients).Commit();

            _bottomBar = BottomBar.Attach(this, savedInstanceState);
            _bottomBar.SetItems(Resource.Menu.bottombar_menu);
            _bottomBar.SetOnMenuTabClickListener(this);
            // Setting colors for different tabs when there's more than three of them.
            // You can set colors for tabs in two different ways as shown below.
            _bottomBar.MapColorForTab(0, "#5D4037");
            _bottomBar.MapColorForTab(1, "#5D4037");
            _bottomBar.MapColorForTab(2, "#7B1FA2");
            //_bottomBar.MapColorForTab(3, "#FF5252");
            //_bottomBar.MapColorForTab(4, "#FF9800");
            //_bottomBar.Hide(false);//скрытие нижней панели
        }
Ejemplo n.º 6
0
 public NavBarMagicOnGlobalLayoutListener(BottomBar bottomBar, View outerContainer, int navBarHeightCopy, bool isTabletMode)
 {
     _bottomBar        = bottomBar;
     _outerContainer   = outerContainer;
     _navBarHeightCopy = navBarHeightCopy;
     _isTabletMode     = isTabletMode;
 }
Ejemplo n.º 7
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            handler       = new Handler();
            mainPresenter = new MainPresenter(this);

            toolbar       = FindViewById <Toolbar>(Resource.Id.toolbar);
            toolbar.Title = Resources.GetString(Resource.String.daily);
            SetSupportActionBar(toolbar);

            fm = SupportFragmentManager;

            bottomBar = BottomBar.AttachShy((CoordinatorLayout)FindViewById(Resource.Id.coordinatorLayout), FindViewById(Resource.Id.swipeRefreshLayout), bundle);

            bottomBar.UseFixedMode();

            bottomBar.SetItems(Resource.Menu.bottombar_menu);
            bottomBar.SetOnMenuTabClickListener(this);

            MobclickAgent.SetDebugMode(true);
            MobclickAgent.OpenActivityDurationTrack(false);
            MobclickAgent.SetScenarioType(this, MobclickAgent.EScenarioType.EUmNormal);

            updManager = IFlytekUpdate.GetInstance(this);
            updManager.SetDebugMode(true);
            updManager.SetParameter(UpdateConstants.ExtraWifionly, "true");
            updManager.SetParameter(UpdateConstants.ExtraNotiIcon, "true");
            updManager.SetParameter(UpdateConstants.ExtraStyle, UpdateConstants.UpdateUiDialog);
            updManager.AutoUpdate(this, this);
        }
Ejemplo n.º 8
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.Fixed);

            // Create your application here
            _bottomBar = BottomBar.AttachShy(FindViewById <CoordinatorLayout>(Resource.Id.myCoordinator),
                                             FindViewById(Resource.Id.myScrollingContent), savedInstanceState);

            _bottomBar.UseFixedMode();
            _bottomBar.UseDarkThemeWithAlpha();

            _bottomBar.SetItems(new [] {
                new BottomBarTab(Resource.Drawable.ic_recents, "Recents"),
                new BottomBarTab(Resource.Drawable.ic_favorites, "Favorites"),
                new BottomBarTab(Resource.Drawable.ic_nearby, "Nearby")
            });
            _badge0 = _bottomBar.MakeBadgeForTabAt(0, Color.Green, 100);
            _badge0.AutoShowAfterUnSelection = true;

            _badge1 = _bottomBar.MakeBadgeForTabAt(1, Color.Green, 100);
            _badge1.AutoShowAfterUnSelection = true;
            _badge1.Position = BottomNavigationBar.Enums.BadgePosition.Left;

            _badge2       = new CustomBottomBarBadge(this, 2, Color.Green);
            _badge2.Count = 100;
            _bottomBar.MakeBadgeForTab(_badge2);

            _bottomBar.SetOnTabClickListener(this);

            _bottomBar.SetActiveTabColor(Color.Red);
        }
Ejemplo n.º 9
0
 public static void Draw()
 {
     GUI.DrawTexture(new Rect(0f, (float)Screen.height - GUIM.YRES(32f), (float)Screen.width, GUIM.YRES(32f)), BottomBar.tBlack);
     BottomBar.DrawButton(0, BottomBar.rButton[0], Lang.Get("_LANGUAGE"), BottomBar.tLang);
     BottomBar.DrawButton(1, BottomBar.rButton[1], Lang.Get("_MUTE"), BottomBar.tVolume);
     BottomBar.DrawButton(2, BottomBar.rButton[2], Lang.Get("_FULLSCREEN_F9"), BottomBar.tScreen);
 }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.Fixed);

            // Create your application here
            _bottomBar = BottomBar.AttachShy(FindViewById <CoordinatorLayout>(Resource.Id.myCoordinator),
                                             FindViewById(Resource.Id.myScrollingContent), savedInstanceState);

            _bottomBar.UseFixedMode();
//            update BottomNavigationBar nuget package to 1.0.9
            _bottomBar.UseDarkThemeWithAlpha(false);

            _bottomBar.SetItems(new [] {
                new BottomBarTab(Resource.Drawable.ic_recents, "Recents"),
                new BottomBarTab(Resource.Drawable.ic_favorites, "Favorites"),
                new BottomBarTab(Resource.Drawable.ic_nearby, "Nearby")
            });

            _bottomBar.SetOnTabClickListener(this);

            _bottomBar.SetActiveTabColor(Color.Red);
//            _bottomBar.SetActiveTabColor(Resources.GetColor(Resource.Color.colorAccent, Theme));
        }
Ejemplo n.º 11
0
        protected override void OnElementChanged(ElementChangedEventArgs <BottomTabbed> e)
        {
            base.OnElementChanged(e);

            if (e.NewElement != null)
            {
                BottomTabbed bottomBarPage = e.NewElement;

                if (_bottomBar == null)
                {
                    _pageController = PageController.Create(bottomBarPage);

                    // create a view which will act as container for Page's
                    _frameLayout = new FrameLayout(Forms.Context);
                    _frameLayout.LayoutParameters = new FrameLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent, GravityFlags.Fill);

                    AddView(_frameLayout, 0);

                    // create bottomBar control
                    _bottomBar = BottomNavigationBar.BottomBar.Attach(_frameLayout, null);
                    _bottomBar.NoTabletGoodness();

                    if (bottomBarPage.FixedMode)
                    {
                        _bottomBar.UseFixedMode();
                    }

                    switch (bottomBarPage.BarTheme)
                    {
                    case BottomTabbed.BarThemeTypes.Light:
                        break;

                    case BottomTabbed.BarThemeTypes.DarkWithAlpha:
                        _bottomBar.UseDarkThemeWithAlpha(true);
                        break;

                    case BottomTabbed.BarThemeTypes.DarkWithoutAlpha:
                        _bottomBar.UseDarkThemeWithAlpha(false);
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }
                    _bottomBar.LayoutParameters = new LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent);
                    _bottomBar.SetOnTabClickListener(this);

                    UpdateTabs();
                    UpdateBarBackgroundColor();
                    UpdateBarTextColor();

                    _bottomBar.SetTextAppearance(Resource.Style.TabTextStyle);
                    _bottomBar.IgnoreScalingResize = true;
                }

                if (bottomBarPage.CurrentPage != null)
                {
                    SwitchContent(bottomBarPage.CurrentPage);
                }
            }
        }
        private void ClearElement(MainPage element)
        {
            if (_currentPage == null)
            {
                return;
            }
            var renderer = Platform.GetRenderer(_currentPage);

            if (renderer != null)
            {
                renderer.ViewGroup.RemoveFromParent();
                renderer.ViewGroup.Dispose();
                renderer.Dispose();

                _currentPage = null;
            }

            if (_bottomBar == null)
            {
                return;
            }
            _bottomBar.RemoveFromParent();
            _bottomBar.Dispose();
            _bottomBar = null;
        }
Ejemplo n.º 13
0
        private void PopulateBottomBarItems(BottomBar bar, IEnumerable <Page> pages)
        {
            var barItems = pages.Select(x => new BottomBarTab(Context.Resources.GetDrawable(x.Icon), x.Title));

            bar.SetItems(barItems.ToArray());
            bar.SetActiveTabColor(Color.ParseColor("#FF0000"));
        }
Ejemplo n.º 14
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication uiApplication, NSDictionary launchOptions)
        {
            global::Xamarin.Forms.Forms.Init();
            BottomBar.Init();
            LoadApplication(new App());

            return(base.FinishedLaunching(uiApplication, launchOptions));
        }
Ejemplo n.º 15
0
        private void PopulateBottomBarItems(BottomBar bar, IEnumerable <Page> pages)
        {
            var barItems = pages.Select(x => new BottomBarTab(Context.Resources.GetDrawable(x.Icon), x.Title));

            bar.SetFixedInactiveIconColor(Color.Rgb(0, 133, 143));
            bar.SetActiveTabColor(Color.White);
            bar.SetItems(barItems.ToArray());
        }
Ejemplo n.º 16
0
        protected override void OnElementChanged(ElementChangedEventArgs <BottomBarPage> e)
        {
            base.OnElementChanged(e);

            if (e.NewElement != null)
            {
                var bottomBarPage = e.NewElement;

                if (bottomBar == null)
                {
                    pageController = PageController.Create(bottomBarPage);

                    // create a view which will act as container for Page's
                    frameLayout = new FrameLayout(Forms.Context)
                    {
                        LayoutParameters = new FrameLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent, GravityFlags.Fill)
                    };
                    AddView(frameLayout, 0);

                    // create bottomBar control
                    bottomBar = BottomBar.Attach(frameLayout, null);
                    bottomBar.NoTabletGoodness();
                    bottomBar.MaxFixedTabCount = Element.Children.Count - 1;
                    if (bottomBarPage.FixedMode)
                    {
                        bottomBar.UseFixedMode();
                    }

                    switch (bottomBarPage.BarTheme)
                    {
                    case BottomBarPage.BarThemeTypes.Light:
                        break;

                    case BottomBarPage.BarThemeTypes.DarkWithAlpha:
                        bottomBar.UseDarkThemeWithAlpha();
                        break;

                    case BottomBarPage.BarThemeTypes.DarkWithoutAlpha:
                        bottomBar.UseDarkThemeWithAlpha(false);
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }
                    bottomBar.LayoutParameters = new LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent);
                    bottomBar.SetOnTabClickListener(this);

                    UpdateTabs();
                    UpdateBarBackgroundColor();
                    UpdateBarTextColor();
                }

                if (bottomBarPage.CurrentPage != null)
                {
                    SwitchContent(bottomBarPage.CurrentPage);
                }
            }
        }
Ejemplo n.º 17
0
        private void PopulateChildren(NotifyPage element)
        {
            _bottomBar?.RemoveFromParent();

            _bottomBar = CreateBottomBar(element.Children);
            AddView(_bottomBar);

            LoadPageContent(0);
        }
Ejemplo n.º 18
0
        private void PopulateChildren(MainTabbedPage element)
        {
            // 作者說明 bottomBar 無法直接使用,因此要刪除重建
            _bottomBar?.RemoveFromParent();

            _bottomBar = CreateBottomBar(element.Children);
            AddView(_bottomBar);

            LoadPageContent(0);
        }
Ejemplo n.º 19
0
        private void PopulateChildren(TabbedPage1 element)
        {
            // Unfortunately bottom bar can not be reused so we have to
            // remove it and create the new instance
            _bottomBar?.RemoveFromParent();

            _bottomBar = CreateBottomBar(element.Children);
            AddView(_bottomBar);
            LoadPageContent(0);
        }
Ejemplo n.º 20
0
        private void PopulateChildren(MainPage element)
        {
            // The author explains that bottomBar can not be used directly, so remove the rebuild
            _bottomBar?.RemoveFromParent();

            _bottomBar = CreateBottomBar(element.Children);
            AddView(_bottomBar);

            LoadPageContent(1);
        }
Ejemplo n.º 21
0
        /// <summary>
        /// 生成新的底部控件
        /// </summary>
        /// <param name="element"></param>
        private void PopulateChildren(MainAppPage element)
        {
            //我们需要删除原有的底部控件,然后添加新的
            _bottomBar?.RemoveFromParent();

            _bottomBar = CreateBottomBar(element);
            AddView(_bottomBar);

            LoadPageContent(0);
        }
Ejemplo n.º 22
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(savedInstanceState);

            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
            CrossCurrentActivity.Current.Init(this, savedInstanceState);
            BottomBar.Init();
            LoadApplication(new App());
        }
        /// <summary>
        /// 生成新的底部控件
        /// </summary>
        /// <param name="element"></param>
        private void PopulateChildren(MainPage element)
        {
            // Unfortunately bottom bar can not be reused so we have to
            // remove it and create the new instance
            // 我们需要删除原有的底部控件,然后添加新的
            _bottomBar?.RemoveFromParent();

            _bottomBar = CreateBottomBar(element);
            AddView(_bottomBar);

            LoadPageContent(0);
        }
Ejemplo n.º 24
0
        private void frmPay_Load(object sender, EventArgs e)
        {
            //设置客显
            UpdateDisplay();

            //显示金额和数量
            lbYH.Text         = (sell.YH + sell.DZ).ToString();
            lbMoneyTotal.Text = ZJ.ToString();
            lbGoodsCount.Text = sell.GoodsCount.ToString();
            lbCash.Text       = Cash.ToString();

            //加载底部信息栏
            BottomBar bottom = new BottomBar(staff);

            Controls.Add(bottom);
            bottom.Location = new Point(0, 575);
            bottom.Show();

            //禁用支付方式删除和修改按钮
            btnDel.Enabled   = false;
            btnAlter.Enabled = false;

            //有内部会员卡显示会员卡支付按钮
            if (sell.Mname != "" && !sell.isCash)
            {
                btnMCardPay.Visible = true;

                miniKeyboard.Enabled = false;
                dgvCardPay.Enabled   = false;
                btnAdd.Enabled       = false;
                btnDel.Enabled       = false;
                btnAlter.Enabled     = false;
            }
            else
            {
                btnMCardPay.Visible = false;
            }

            //得到小票列表
            rList = new List <Receipt>();
            if (File.Exists(GlobalParams.recLocalPath))
            {
                BinaryFormatter formatter = new BinaryFormatter();
                //反序列化小票单
                using (Stream input = File.OpenRead(GlobalParams.recLocalPath))
                {
                    if (input.Length > 0)
                    {
                        rList = (List <Receipt>)formatter.Deserialize(input);
                    }
                }
            }
        }
Ejemplo n.º 25
0
        public override void OnViewStarted(bool firstTime)
        {
            base.OnViewStarted(firstTime);

            try
            {
                _firstTime = firstTime;

                _locationService.Start();

                if (_orderWorkflowService.IsOrderRebooked())
                {
                    _bottomBar.ReviewOrderDetails().FireAndForget();
                }

                if (firstTime)
                {
                    Panel.Start().FireAndForget();

                    AddressPicker.RefreshFilteredAddress();

                    this.Services().ApplicationInfo.CheckVersionAsync().FireAndForget();

                    CheckTermsAsync();

                    CheckCreditCardExpiration().FireAndForget();

                    BottomBar.CheckManualRideLinqEnabledAsync();

                    _isShowingTutorial = _tutorialService.DisplayTutorialToNewUser(() =>
                    {
                        _isShowingTutorial = false;
                        LocateUserIfNeeded();
                    });
                    _pushNotificationService.RegisterDeviceForPushNotifications(force: true);
                }

                LocateUserIfNeeded();

                if (_defaultHintZoomLevel != null)
                {
                    ChangePresentation(_defaultHintZoomLevel);
                    _defaultHintZoomLevel = null;
                }

                _vehicleService.Start();
            }
            catch (Exception ex)
            {
                Logger.LogError(ex);
            }
        }
Ejemplo n.º 26
0
        private BottomBar CreateBottomBar(IEnumerable <Page> pageIntents)
        {
            var bar = new BottomBar(Context);

            // TODO: Configure the bottom bar here according to your needs

            bar.SetOnTabClickListener(this);
            bar.UseFixedMode();
            PopulateBottomBarItems(bar, pageIntents);
            bar.ItemContainer.SetBackgroundColor(Android.Graphics.Color.ParseColor("#edecee"));

            return(bar);
        }
Ejemplo n.º 27
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Main);
            FindViewById(Resource.Id.simple_three_tabs).SetOnClickListener(this);
            FindViewById(Resource.Id.icons_only).SetOnClickListener(this);
            FindViewById(Resource.Id.five_tabs_changing_colors).SetOnClickListener(this);
            FindViewById(Resource.Id.three_tabs_quick_return).SetOnClickListener(this);
            FindViewById(Resource.Id.five_tabs_custom_colors).SetOnClickListener(this);
            FindViewById(Resource.Id.badges).SetOnClickListener(this);

            BottomBar bar = new BottomBar();
        }
    void Start()
    {
        GameObject go;

        go     = GameObject.Find("GUI Manager/HeroBotBar");
        botBar = go.GetComponent <BottomBar>();

        controller       = this.GetComponent <HeroController>();
        playerStatus     = this.GetComponent <PlayerStatus>();
        animationManager = this.GetComponent <AnimationManager>();

        UpdatePassiveStatus();
    }
Ejemplo n.º 29
0
        private void PopulateChildren(MainPage element)
        {
            // Unfortunately bottom bar can not be reused so we have to
            // remove it and create the new instance
            _bottomBar?.RemoveFromParent();

            _bottomBar = CreateBottomBar(element.Children);
            AddView(_bottomBar);

            LoadPageContent(0);

            //LoadPageContent(1);
            //_bottomBar.SelectTabAtPosition(1, false);
        }
Ejemplo n.º 30
0
        void ReleaseDesignerOutlets()
        {
            if (BottomBar != null)
            {
                BottomBar.Dispose();
                BottomBar = null;
            }

            if (DateLabel != null)
            {
                DateLabel.Dispose();
                DateLabel = null;
            }

            if (DeleteButton != null)
            {
                DeleteButton.Dispose();
                DeleteButton = null;
            }

            if (LikeButton != null)
            {
                LikeButton.Dispose();
                LikeButton = null;
            }

            if (PhotoImageView != null)
            {
                PhotoImageView.Dispose();
                PhotoImageView = null;
            }

            if (ProfilePictureImageView != null)
            {
                ProfilePictureImageView.Dispose();
                ProfilePictureImageView = null;
            }

            if (TopBar != null)
            {
                TopBar.Dispose();
                TopBar = null;
            }

            if (UserName != null)
            {
                UserName.Dispose();
                UserName = null;
            }
        }
Ejemplo n.º 31
0
    public void Initialize(Transform anchorRef)
    {
        // Create The Players
        GameObject tmpPlayer1 = Instantiate(Resources.Load<GameObject>("Prefabs/PlayerObjects/Player")) as GameObject;
        tmpPlayer1.name = "Player1";
        tmpPlayer1.transform.position = new Vector3(-5, 0, 0);
        //tmpPlayer1.AddComponent<Hadouken>();

        GameObject tmpPlayer2 = Instantiate(Resources.Load<GameObject>("Prefabs/PlayerObjects/Player")) as GameObject;
        tmpPlayer2.name = "Player2";
        tmpPlayer2.transform.position = new Vector3(5, 0, 0);

        // Create the UI
        GameObject BottomBarGO = Instantiate(Resources.Load<GameObject>("Prefabs/BottomBar/BottomBar")) as GameObject;
        BottomBarGO.transform.SetParent(anchorRef, false);
        BottomBarRef = BottomBarGO.GetComponent<BottomBar>();

        List<Ability> abilities = new List<Ability>();

        List<Action> HadoukenActions = new List<Action>(){new Blast(tmpPlayer1)};
        Ability Hadouken = new Ability("Hadouken");
        Hadouken.Actions = HadoukenActions;
        abilities.Add(Hadouken);

        List<Action> bigMidHitActions = new List<Action>(){new CreateSquare(tmpPlayer1)};
        Ability bigMidHit = new Ability("Slash");
        bigMidHit.Actions = bigMidHitActions;
        abilities.Add(bigMidHit);

        BottomBarRef.Initialize(tmpPlayer1, abilities);
        GameObject TopBarGO = Instantiate(Resources.Load<GameObject>("Prefabs/BottomBar/TopBar")) as GameObject;
        TopBarGO.transform.SetParent(anchorRef, false);

        // Finally initialize the Players
        Player1 = tmpPlayer1.AddComponent<BasicCharacter>();
        Player1.Initialize(TopBarGO, true, 20, abilities);

        Player2 = tmpPlayer2.AddComponent<BasicCharacter>();
        Player2.Initialize(TopBarGO, false, 20, new List<Ability>());
    }