示例#1
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
     DontDestroyOnLoad(gameObject);
 }
示例#2
0
        public void update()
        {
            double ActualWidths  = ActualWidth - 60;
            double ActualHeights = ActualHeight - 60 - 60;

            VisiableGrid.Children.Clear();
            VisiableGrid.ColumnDefinitions.Clear();
            VisiableGrid.RowDefinitions.Clear();
            int    cnt             = (int)Math.Floor(ActualWidths / 266.25); // Visiable Area Length ( Widths )
            int    hcnt            = (int)Math.Floor(ActualHeights / 171);
            int    shouldShowDatas = TeamData.files == null ? 0 : TeamData.files.Length;
            int    count           = page == 0 ? 0 : page * cnt * hcnt;
            double another         = ActualWidths - cnt * 266.25; // Side Area check ( Cause we will make this to center )
            double tanother        = ActualHeights - (hcnt * 171);
            int    current         = -3;
            int    rcurrent        = -3;

            control.setMaxPage(shouldShowDatas > cnt * hcnt ? (int)Math.Ceiling(shouldShowDatas / (double)(cnt * hcnt)) : 1);
            RowDefinition row = new RowDefinition();

            if (another > 0)
            {
                ColumnDefinition col = new ColumnDefinition();
                col.Width = new GridLength(another / 2);
                VisiableGrid.ColumnDefinitions.Add(col);
                current++;
            }
            if (tanother > 0)
            {
                row        = new RowDefinition();
                row.Height = new GridLength(tanother / 2);
                VisiableGrid.RowDefinitions.Add(row);
                rcurrent++;
            }
            /*Adding Grid*/
            for (int j = 0; j < hcnt; j++)
            {
                row        = new RowDefinition();
                row.Height = new GridLength(10.5);
                VisiableGrid.RowDefinitions.Add(row);
                row        = new RowDefinition();
                row.Height = new GridLength(150);
                VisiableGrid.RowDefinitions.Add(row);
                row        = new RowDefinition();
                row.Height = new GridLength(10.5);
                VisiableGrid.RowDefinitions.Add(row);
            }
            for (int i = 0; i < cnt; i++)
            {
                ColumnDefinition col1 = new ColumnDefinition();
                col1.Width = new GridLength(30.25 / 2);
                ColumnDefinition col2 = new ColumnDefinition();
                col2.Width = new GridLength(236);
                ColumnDefinition col3 = new ColumnDefinition();
                col3.Width = new GridLength(30.25 / 2);
                VisiableGrid.ColumnDefinitions.Add(col1);
                VisiableGrid.ColumnDefinitions.Add(col2);
                VisiableGrid.ColumnDefinitions.Add(col3);
            }
            /* Setter */

            for (int i = 0; i < ((shouldShowDatas - (cnt * hcnt * page)) / cnt + 1 > hcnt ? hcnt : (shouldShowDatas - (cnt * hcnt * page)) / cnt + 1); i++)
            {
                rcurrent += 3;
                for (int j = 0; j < ((shouldShowDatas - (cnt * hcnt * page)) - (cnt * i) > cnt ? cnt : (shouldShowDatas - (cnt * hcnt * page)) - (cnt * i)); j++)
                {
                    current += 3;
                    ShareUI ui = new ShareUI();
                    ui.Width  = 236;
                    ui.Height = 150;
                    ui.setName(TeamData.files[count++]);
                    ui.setIndex(count - 1);
                    Grid.SetColumn(ui, current + 1);
                    Grid.SetRow(ui, rcurrent + 1);
                    VisiableGrid.Children.Add(ui);
                }
                current = another > 0 ? -2 : -3;
            }
            row        = new RowDefinition();
            row.Height = new GridLength(100);
            VisiableGrid.RowDefinitions.Add(row);

            control.Height = 60;
            Grid.SetRow(control, 3 * hcnt + 3);
            Grid.SetColumnSpan(control, 3 * cnt + (another > 0 ? 1 : 0) + 1);
            control.HorizontalAlignment = HorizontalAlignment.Center;
            control.VerticalAlignment   = VerticalAlignment.Top;
            VisiableGrid.Children.Add(control);
        }
示例#3
0
        public CoreUI(OpCore core)
        {
            Core = core;

            // load menus for loaded services
            foreach (var service in Core.ServiceMap.Values)
            {
                var id = service.ServiceID;

                if (id == ServiceIDs.Board)
                {
                    Services[id] = new BoardUI(this, service);
                }

                if (id == ServiceIDs.Buddy)
                {
                    Services[id] = new BuddyUI(this, service);
                }

                if (id == ServiceIDs.Chat)
                {
                    Services[id] = new ChatUI(this, service);
                }

                if (id == ServiceIDs.IM)
                {
                    Services[id] = new IMUI(this, service);
                }

                if (id == ServiceIDs.Mail)
                {
                    Services[id] = new MailUI(this, service);
                }

                if (id == ServiceIDs.Plan)
                {
                    Services[id] = new PlanUI(this, service);
                }

                if (id == ServiceIDs.Profile)
                {
                    Services[id] = new ProfileUI(this, service);
                }

                if (id == ServiceIDs.Share)
                {
                    Services[id] = new ShareUI(this, service);
                }

                if (id == ServiceIDs.Storage)
                {
                    Services[id] = new StorageUI(this, service);
                }

                if (id == ServiceIDs.Trust)
                {
                    Services[id] = new TrustUI(this, service);
                }
            }

            Core.RunInGui      += Core_RunInGui;
            Core.UpdateConsole += Core_UpdateConsole;
            Core.ShowConfirm   += Core_ShowConfirm;
            Core.ShowMessage   += Core_ShowMessage;
            Core.VerifyPass    += Core_VerifyPass;

            Core_UpdateConsole("DeOps " + Application.ProductVersion);
        }