public override void InstantiateComponents() { base.InstantiateComponents(); _battleActionListBox = new Listbox <BattleActions>(5, 1); _battleActionListBox.Width = 15; _battleActionListBox.Height = 6; RegisterControl(_battleActionListBox); _outputBox = new OutputBox(24, 2); _outputBox.Width = Application.Width - 25; _outputBox.MaxRows = 6; RegisterControl(_outputBox); _playerHealth = new Progressbar(6, 9); _playerHealth.Width = 40; RegisterControl(_playerHealth); _playerImage = new Image(6, 12); RegisterControl(_playerImage); _enemyHealth = new Progressbar(55, 9); _enemyHealth.Width = 40; RegisterControl(_enemyHealth); _enemyImage = new Image(55, 12); RegisterControl(_enemyImage); _battleActionListBox.SelectionChanged += _battleActionListBox_SelectionChanged; _playerImage.SetImageFromFile("Resources/Encounters/Images/player.asc"); _playerHealth.Maximum = GameManager.Instance.State.MaxHealth; _playerHealth.Value = GameManager.Instance.State.Health; }
public static void Show() { if (layer) { return; } layer = Templates.GetDuplicate(key); layer.transform.SetParent(Global.MessageCanvas, false); layer.gameObject.SetActive(true); var rect = layer.GetComponent <RectTransform>(); rect.sizeDelta = new Vector2(Global.ReferenceResolution.x, Global.ReferenceResolution.y); rect.anchorMin = new Vector2(0.5f, 0.5f); rect.anchorMax = new Vector2(0.5f, 0.5f); rect.pivot = new Vector2(0.5f, 0.5f); rect.anchoredPosition = Vector3.zero; if (progressbar == null) { progressbar = Util.Get <Progressbar>(layer.gameObject, "Progressbar"); } if (textTips == null) { textTips = Util.Get <Text>(layer.gameObject, "TextTips"); } Stick(); isShow = true; }
public XPManager(Yat yat, Progressbar experienceBar, Texture2D orb, SoundEffect twinkleEffect) { this.yat = yat; this.experienceBar = experienceBar; this.orb = orb; this.twinkle = twinkleEffect; }
public override void CountData(string file, IWin32Window owner, DataGridViewCell cell) { dataList.Clear(); this.countDataCell = cell; ExtractDataFrom = file; StreamReader sr = new StreamReader(File.OpenRead(ExtractDataFrom)); ProgressEnds = sr.BaseStream.Length + 2; // is set to -2 because the Progressbar has not to be closed to early Progress = 0; sr.Close(); // creates the Thread which updates the data for the progressbar Thread progressBar = new Thread(ProgressBarThread); Thread extractionThread = new Thread(this.ExtractDataStructureThread); // creates the Progressbar Window Progressbar pb = new Progressbar("Counting " + this.GetLabel() + "...", "Bytes"); // Sets the Maximum of the Progressbar pb.SetMaximum(ProgressEnds); // starts both Threads progressBar.Start(pb); extractionThread.Start(); // show Progressbar and disable the owner pb.ShowDialog(owner); }
protected override void Start() { base.Start(); this.m_ResultStorageContainer = WidgetUtility.Find <ItemContainer>(this.m_ResultStorageWindow); this.m_RequiredIngredientsContainer = WidgetUtility.Find <ItemContainer>(this.m_RequiredIngredientsWindow); this.m_Progressbar = WidgetUtility.Find <Progressbar>(this.m_CraftingProgressbar); }
private void ScanForStartEnds(IWin32Window owner) { StreamReader sr = new StreamReader(File.OpenRead(ExtractDataFrom)); ProgressEnds = sr.BaseStream.Length; // is set to -2 because the Progressbar has not to be closed to early Progress = -2; sr.Close(); // creates the Thread which updates the data for the progressbar Thread progressBar = new Thread(ProgressBarThread); Thread extractionThread = new Thread(this.ScanThread); // creates the Progressbar Window Progressbar pb = new Progressbar("Finding Jpegs (" + this.GetLabel() + ")...", "Bytes"); // Sets the Maximum of the Progressbar pb.SetMaximum(ProgressEnds); // starts both Threads progressBar.Start(pb); extractionThread.Start(); // show Progressbar and disable the owner pb.ShowDialog(owner); }
public override void CountData(string file, IWin32Window owner, DataGridViewCell cell) { CountDataCell = cell; StreamReader sbu = new StreamReader(File.OpenRead(file)); // Sets the Length of the file ProgressEnds = sbu.BaseStream.Length; // is set to -2 because the Progressbar has not to be closed to early Progress = -2; sbu.Close(); // creates the Thread which counts the data Thread th = new Thread(CountDataThread); // creates the Thread which updates the data for the progressbar Thread progressBar = new Thread(ProgressBarThread); // creates the Progressbar Window Progressbar pb = new Progressbar("Counting " + Label + "...", "Bytes"); // Sets the Maximum of the Progressbar pb.SetMaximum(ProgressEnds); // starts both Threads progressBar.Start(pb); th.Start(file); // shows the Progressbar as an Dialog to disable owner pb.ShowDialog(owner); }
public void Start() { // Setup _prv = Core.ActiveContainer; _frmModal = new Form("modalWaitForm", Colors.Ghost); Core.SilentlyActivate(_frmModal); Core.Screen.SetClippingRectangle(0, 0, _frmModal.Width, _frmModal.Height); Core.ShadowRegion(_x, _y, _w, _h); Core.Screen.DrawRectangle(0, 0, _x, _y, _w, 1, 0, 0, Colors.Ghost, 0, 0, Colors.Ghost, 0, 0, 179); Core.Screen.DrawRectangle(0, 0, _x, _y + _h - 1, _w, 1, 0, 0, Colors.Ghost, 0, 0, Colors.Ghost, 0, 0, 179); Core.Screen.DrawRectangle(0, 0, _x, _y + 1, 1, _h - 2, 0, 0, Colors.Ghost, 0, 0, Colors.Ghost, 0, 0, 179); Core.Screen.DrawRectangle(0, 0, _x + _w - 1, _y + 1, 1, _h - 2, 0, 0, Colors.Ghost, 0, 0, Colors.Ghost, 0, 0, 179); Core.Screen.DrawRectangle(0, 0, _x + 1, _y + 1, _w - 2, _h - 2, 0, 0, Colors.Ghost, 0, 0, Colors.Ghost, 0, 0, 256); Core.Screen.DrawRectangle(0, 0, _x + 1, _y + 1, _w - 2, 1, 0, 0, Colors.White, 0, 0, Colors.White, 0, 0, 51); Core.Screen.DrawRectangle(0, 0, _x + 1, _y + 2, _w - 2, 1, 0, 0, Colors.White, 0, 0, Colors.White, 0, 0, 26); // Add Progressbar _prog = new Progressbar("prog1", _x + 16, _y + _h - ((_large) ? 38 : 31), _w - 32, ((_large) ? 22 : 15), _min, _max, _value); // Draw Text Core.Screen.DrawTextInRect(_text, _x + 16, _y + 16, _w - 32, _h - _prog.Height - 32, Bitmap.DT_WordWrap, Colors.CharcoalDust, _font); _frmModal.AddChild(_prog); Core.Screen.Flush(_x - 2, _y - 2, _w + 4, _h + 4); }
public override void Load() { base.Load(); ConveyorSoundEffect = ContentManager.ConveyorSoundEffect.CreateInstance(); ConveyorSoundEffect.Volume = 0.4f; Player = new Player(new PlayerInput() { Jump = Keys.W, Left = Keys.A, Right = Keys.D, Windup = Keys.Space }) { MaxSpeed = new Vector2(10, 10), MaxAcceleration = 3, Acceleration = 1f, ConveyorSpeed = ConveyorSpeed }; Player.Position = new Vector2(1000, 470 - Player.Size.Height); Progressbar = new Progressbar(Player, new System.Drawing.Size(80, 20)) { MaxValue = Player.ALIVE_MAX, Value = 0 }; ConveyorHitBox = new Sprite() { Texture = ContentManager.ProgressBarBackground, Position = new Vector2(JamGame.ScreenWidth - 1000, 470), Size = new System.Drawing.Size(2000, 80) }; Conveyor = new Conveyor() { Position = new Vector2(JamGame.ScreenWidth - 1080, 400), Size = new System.Drawing.Size(2000, 100) }; Clock = new Clock(ContentManager.Clock, 30) { Position = new Vector2(JamGame.ScreenWidth - 592, 115), Size = new System.Drawing.Size(175, 175) }; Components.Add(Clock); // Häcksler Components.Add(new Chopper() { Position = new Vector2(25, 600), Size = new System.Drawing.Size(JamGame.ScreenWidth - 900, 600) }); Components.Add(Progressbar); Components.Add(ConveyorHitBox); Components.Add(Conveyor); Components.Add(Player); GameStarted = false; GameStartTimer = 0; Conveyor.AnimationManager.Animation.FrameSpeed = 999999; Level = 1; AddDebugInfo(); }
private void UpdateCooldownBar(Progressbar cooldownBar, AbilityTower tower) { if (tower != null) { cooldownBar.MaxValue = (int)(tower.ability.CoolDown * 100); cooldownBar.UpdateValue((int)(tower.ability.CooldownTimer * 100)); } }
private void SetHealth(Progressbar progressbar, int health, bool isMax) { if (isMax) { progressbar.Maximum = health; } progressbar.Value = health; }
public void Update() { Progressbar progressbar = GameObject.FindGameObjectWithTag("ProgressBar").GetComponent <Progressbar>(); //if all teams are ready if (progressbar.allTeamsReady() && noTopicsSet) { setTopics(); noTopicsSet = false; } }
public Experience(Yat yat, Progressbar experienceBar, Texture2D orb, SoundEffect twinkleEffect, Vector2 position, int strength, double startAngle) { this.yat = yat; this.experienceBar = experienceBar; this.orb = orb; this.twinkle = null;// twinkleEffect.CreateInstance(); this.Position = position; this.strength = strength; this.Visible = true; this.Angle = startAngle; }
public override void OnStart() { this.m_Time = 0f; this.m_Widget = WidgetUtility.Find <Progressbar>(this.m_WidgetName); if (this.m_Widget == null) { Debug.LogWarning("Missing progressbar widget " + this.m_WidgetName + " in scene!"); return; } this.m_Widget.Show(); }
public void CastSpell(UInt32 nID) { Unity.Logout.Log("FireWeapon::CastSpell:nID=" + nID); if (gameObject == null) { return; } if (_FireConditions.Count <= 0) { return; } foreach (var condition in _FireConditions[nID]) { if (!condition.CanFire(_Weapons[nID])) { return; } } _Weapons[nID].Duration = _Weapons[nID].CooldownTime; myship.PlaySparksEffect(); weapon_parent = Trans.FindObj(gameObject, "weapon_born_" + nID); if (weapon_parent == null) { Debug.LogError("not found " + "weapon_born_" + nID); } string logStr = "FireWeapon::CastSpell: " + "position:" + weapon_parent.transform.position + ",eulerAngles:" + weapon_parent.transform.eulerAngles + ",forward:" + weapon_parent.transform.forward; Debug.Log(logStr); Unity.Logout.Log(logStr); KBEngine.Event.fireIn("useWeapon", weapon_parent.transform.position, weapon_parent.transform.eulerAngles, weapon_parent.transform.forward, nID); GameObject BarObj = Trans.FindObj(Camera.main.gameObject, _Weapons[nID].BarNode); if (BarObj != null) { Progressbar BarScript = BarObj.GetComponent <Progressbar>(); BarScript.Progressbar_WeaponBronEvent(_Weapons[nID]); } }
private static void actionOther(itemScheduler args) { if (args.data is Action) { Progressbar p = new Progressbar(args.action, args.action); p.message = $"{args.idUser}: processing .."; local.taskList.Add(p); var obj = args.data as Action; try { obj(); } catch (Exception ex) { ex.save(); } local.taskList.Remove(p); } }
partial void OnInitialize() { Progressbar = new Progressbar(); Width = 480; Height = 300; DisplayOkButton = true; Ok.Text = "OK"; DisplayCancelButton = true; Cancel.Text = "Cancel"; }
public override void OnEnter() { base.OnEnter(); widget = UIUtility.Find <Progressbar> (_name.Value); if (widget != null) { widget.SetProgress(progress.Value); } if (!everyFrame) { Finish(); } }
static Progressbar LoadProgressbar(Stream fs) { var obj = new Progressbar(ReadString(fs), ReadInt(fs), ReadInt(fs), ReadInt(fs), ReadInt(fs), ReadInt(fs), ReadInt(fs), ReadInt(fs)) { Enabled = ReadBool(fs), Visible = ReadBool(fs), BackColor = ReadColor(fs), BorderColor = ReadColor(fs), GradientBottom = ReadColor(fs), GradientTop = ReadColor(fs), ProgressAlign = (HorizontalAlignment)fs.ReadByte() }; return(obj); }
protected override void Start() { base.Start(); this.m_ResultStorageContainer = WidgetUtility.Find <ItemContainer>(this.m_StorageWindow); this.m_RequiredIngredientsContainer = WidgetUtility.Find <ItemContainer>(this.m_IngredientsWindow); this.m_Progressbar = WidgetUtility.Find <Progressbar>(this.m_CraftingProgressbar); ItemContainer container = GetComponent <ItemContainer>(); if (container != null) { container.RegisterListener("OnShow", (CallbackEventData ev) => { InUse = true; }); container.RegisterListener("OnClose", (CallbackEventData ev) => { InUse = false; }); } }
private double SetProgressBar(int val, int max = -1) { if (max >= 0) { Progressbar.Maximum = max; } Progressbar.Value = val; // perc var perc = (double)Progressbar.Value * 100 / Progressbar.Maximum; Progressbar.CreateGraphics().DrawString(perc.ToString("f0") + "%", new Font("微软雅黑 Light", 15, FontStyle.Regular, GraphicsUnit.Pixel), Brushes.Magenta, new PointF(Progressbar.Width / 2 - 15, Progressbar.Height / 2 - 10)); return(perc); }
public override void ExtractData(string fromFile, string toPath, IWin32Window owner) { ExtractDataFrom = fromFile; // add backslash to easely add the file name ExtractDataTo = toPath + "\\"; // create directory if its not existing! if (!Directory.Exists(ExtractDataTo)) { Directory.CreateDirectory(ExtractDataTo); } // Open the SBU-File using (StreamReader sourceFile = new StreamReader(File.OpenRead(ExtractDataFrom))) { // Set the ProgressEnds to the length of the SBU-File ProgressEnds = sourceFile.BaseStream.Length; // the Progressbar has not to be closed to early Progress = -2; } // create Progressbar window Progressbar pb = new Progressbar("Extracting " + Label + "...", "Bytes"); // set Maximum of the Progress pb.SetMaximum(ProgressEnds); // create Threads Thread th = new Thread(this.ExtractDataThread); Thread prbr = new Thread(this.ProgressBarThread); // Ask for extracting to a single file DialogResult res = MessageBox.Show(owner, "Extract \"" + Label + "\" to single file?", "Extraction method - " + Label, MessageBoxButtons.YesNo); // save the answer ExtractToSingleFile = res == DialogResult.Yes; // Start the Threads prbr.Start(pb); th.Start(); // show Progressbar and disable the owner pb.ShowDialog(owner); }
private void Window_Loaded(object sender, RoutedEventArgs e) { // set window position to middle of parent window Application curApp = Application.Current; Window mainWindow = curApp.MainWindow; this.Left = mainWindow.Left + (mainWindow.Width - this.ActualWidth) / 2; this.Top = mainWindow.Top + (mainWindow.Height - this.ActualHeight) / 2; //start backgroundworker bw_scannbluetooth.RunWorkerAsync(); Duration duration = new Duration(TimeSpan.FromSeconds(13)); System.Windows.Media.Animation.DoubleAnimation doubleanimation = new System.Windows.Media.Animation.DoubleAnimation(200.0, duration); Progressbar.BeginAnimation(ProgressBar.ValueProperty, doubleanimation); }
// is only for updating progressbar data // object: has to be an instance of Progressbar private void ProgressBarThread(object pb) { Progressbar progressBar = (Progressbar)pb; while (Progress < ProgressEnds) { progressBar.SetValue(Progress); Thread.Sleep(100); } // Thread synchronisation to close the Progressbar if (progressBar.InvokeRequired) { progressBar.BeginInvoke((MethodInvoker)progressBar.Close); } else { progressBar.Close(); } }
private IEnumerator Start() { //Setup boss this.player = GameLogic.CurrentGame.player; this.healthbar = GameLogic.CurrentGame.bossProgressbar; this.maxHP = this.hp = this.maxHealth * (GameLogic.IsHard ? 2 : 1); //Setup arrival, then wait for arrival AccelerationMovement mover = GetComponent <AccelerationMovement>(); mover.StartMovement(AccelerationMovement.MovementMode.APPROACH); yield return(new WaitForSeconds(Mathf.Abs(mover.approachSpeed / mover.acceleration))); //Start moving then wait before shooting GetComponent <FigureEightMovement>().enabled = true; yield return(new WaitForSeconds(this.vulnerabilityDelay)); //Add vulnerabilities and start shooting AddVulnerabilities(); this.canShoot = true; }
public static void ShowProgressbar(string message, float value) { if (!ProgressBarShowed) { progressThread = new Thread(() => { Progressbar = new Progressbar(); Progressbar.ShowDialog(); }) { IsBackground = true }; ProgressBarShowed = true; progressThread.Start(); } while (Progressbar == null || !Progressbar.isReady) { Thread.Sleep(100); } Progressbar.setMessage(message, value); }
partial void OnInitialize() { Title = "Select Widgets"; Width = 600; Height = 500; NewSlides = new List<Slide>(); AvailableWidgets = new ObservableCollection<WidgetMetadata>(); Progressbar = new Progressbar(); #if SILVERLIGHT View = new SelectWidgetsDialogView(); #endif var widgetMetaDataRepo = this.GetDependency<IAsyncRepository<WidgetMetadata>>(); var slideConfigPersister = this.GetDependency<IPersistDomainModelsAsync<SlideConfiguration>>(); controller = new SelectWidgetsDialogController(this, widgetMetaDataRepo, slideConfigPersister); PropertyChanged += (o, e) => { if (e.PropertyName == "SearchTerm") TriggerPropertyChanged("FilteredWidgets"); }; }
public override void ExtractData(string fromFile, string toPath, IWin32Window owner) { if (fromFile != ExtractDataFrom) { this.CountData(fromFile, owner, null); } ExtractDataFrom = fromFile; // add backslash to easely add the file name ExtractDataTo = toPath + "\\"; // create directory if its not existing! if (!Directory.Exists(ExtractDataTo)) { Directory.CreateDirectory(ExtractDataTo); } ProgressEnds = dataList.Count + 1; // is set to -2 because the Progressbar has not to be closed to early Progress = 0; // creates the Thread which updates the data for the progressbar Thread progressBar = new Thread(ProgressBarThread); Thread extractionThread = new Thread(this.ExtractDataThread); // creates the Progressbar Window Progressbar pb = new Progressbar("Extracting " + this.GetLabel() + "...", "Files"); // Sets the Maximum of the Progressbar pb.SetMaximum(ProgressEnds); // starts both Threads progressBar.Start(pb); extractionThread.Start(); // show Progressbar and disable the owner pb.ShowDialog(owner); }
public static void ExecTSQL(itemScheduler args) { if (args.data is List <string> ) { Progressbar p = new Progressbar(args.action, args.action); p.message = $"{args.idUser}: processing .."; local.taskList.Add(p); var obj = args.data as List <string>; using (var db = local.getDataObject()) { try { foreach (var v in obj) { db.Execute(v); } } catch (Exception ex) { ex.save(); } } local.taskList.Remove(p); reCallTaskScheduler(); } }
public override void Draw(GraphicContext gc) { var m = Image.FromBytes(TestImage.GetImage()); m = m.ResizeImage(gc.Size); gc.DrawImage(new Point(0, 0), m); var y = BootLogo.Draw(gc.GetBuffer(), 10); var p = new Progressbar { Size = new Size(280, 25), Location = new Point(195, y + 100), Maximum = 100 }; p.OnLoad(); p.OnFinish += (e) => { ScreenManager.ChangeScreen(ScreenIds.Login); }; p.Value = 20; p.OnDraw(gc); Utils.Pause(20); p.Value = 99; p.OnDraw(gc); Utils.Pause(20); p.Value = 100; p.OnDraw(gc); }
public override void ExtractData(string fromFile, string toPath, IWin32Window owner) { ExtractDataFrom = fromFile; // add backslash to easely add the file name ExtractDataTo = toPath + "\\"; // create directory if its not existing! if (!Directory.Exists(ExtractDataTo)) { Directory.CreateDirectory(ExtractDataTo); } StreamReader sr = new StreamReader(File.OpenRead(ExtractDataFrom)); ProgressEnds = sr.BaseStream.Length; // is set to -2 because the Progressbar has not to be closed to early Progress = -2; sr.Close(); // creates the Thread which updates the data for the progressbar Thread progressBar = new Thread(ProgressBarThread); Thread extractionThread = new Thread(this.ExtractDataThread); // creates the Progressbar Window Progressbar pb = new Progressbar("Extracting " + this.GetLabel() + "...", "Bytes"); // Sets the Maximum of the Progressbar pb.SetMaximum(ProgressEnds); // starts both Threads progressBar.Start(pb); extractionThread.Start(); // show Progressbar and disable the owner pb.ShowDialog(owner); }
private void ExtractDataOfPositions(IWin32Window owner) { ProgressEnds = starts.Count * ends.Count; // is set to -2 because the Progressbar has not to be closed to early Progress = -2; // creates the Thread which updates the data for the progressbar Thread progressBar = new Thread(ProgressBarThread); Thread extractionThread = new Thread(this.ExtractThread); // creates the Progressbar Window Progressbar pb = new Progressbar("Extracting Jpegs (" + this.GetLabel() + ")...", "Possibilities"); // Sets the Maximum of the Progressbar pb.SetMaximum(ProgressEnds); // starts both Threads progressBar.Start(pb); extractionThread.Start(); // show Progressbar and disable the owner pb.ShowDialog(owner); }
// Range: -1 Access: 0 Flags: ( 0, 4, 255 ) public static bool do_after( dynamic user = null, double? delay = null, bool? needhand = null, dynamic target = null, bool? progress = null ) { bool _default = false; dynamic Tloc = null; dynamic Uloc = null; bool drifting = false; dynamic holding = null; bool holdingnull = false; Progressbar progbar = null; double endtime = 0; int starttime = 0; if ( needhand == null ) { needhand = true; } if ( target == null ) { target = null; } if ( progress == null ) { progress = true; } if ( !Lang13.Bool( user ) ) { return false; } Tloc = null; if ( Lang13.Bool( target ) ) { Tloc = target.loc; } Uloc = user.loc; drifting = false; if ( !( ((BaseDynamic)user).Process_Spacemove( 0 ) != 0 ) && Lang13.Bool( user.inertia_dir ) ) { drifting = true; } holding = ((Mob)user).get_active_hand(); holdingnull = true; if ( Lang13.Bool( holding ) ) { holdingnull = false; } if ( progress == true ) { progbar = new Progressbar( user, delay, target ); } endtime = Game13.time + ( delay ??0); starttime = Game13.time; _default = true; while (Game13.time < endtime) { Task13.sleep( 1 ); if ( progress == true ) { progbar.update( Game13.time - starttime ); } if ( drifting && !Lang13.Bool( user.inertia_dir ) ) { drifting = false; Uloc = user.loc; } if ( !Lang13.Bool( user ) || Lang13.Bool( user.stat ) || Lang13.Bool( user.weakened ) || Lang13.Bool( user.stunned ) || !drifting && user.loc != Uloc ) { _default = false; break; } if ( Lang13.Bool( Tloc ) && ( !Lang13.Bool( target ) || Tloc != target.loc ) ) { _default = false; break; } if ( needhand == true ) { if ( !holdingnull ) { if ( !Lang13.Bool( holding ) ) { _default = false; break; } } if ( ((Mob)user).get_active_hand() != holding ) { _default = false; break; } } } if ( progress == true ) { GlobalFuncs.qdel( progbar ); } return _default; }
public static string TextNone(Progressbar bar) { return string.Empty; }
public static void Main() { HostWindow window = new HostWindow(delegate { // Create a layer container LayerContainer lc = new LayerContainer(); // Create a form with many buttons { FlowContainer flow = new FlowContainer(10.0, Axis.Vertical); for (int t = 0; t < 40; t++) { int i = t + 1; Button b = new Button("Button #" + i.ToString()); flow.AddChild(b, 30.0); b.Click += delegate { MessageBox.ShowOKCancel(lc, "Button Clicked!", "You have clicked button #" + i.ToString() + ".", null); }; } Point targetflowsize = new Point(120.0, flow.SuggestLength); MarginContainer margin = flow.WithMargin(10.0); Point targetmarginsize = margin.GetSize(targetflowsize); WindowContainer win = new WindowContainer(margin); SunkenContainer sunken = new SunkenContainer(win); ScrollContainer scroll = new ScrollContainer(win, sunken.WithBorder(1.0, 1.0, 0.0, 1.0)); scroll.ClientHeight = targetmarginsize.Y; Form form = new Form(scroll, "Lots of buttons"); form.ClientSize = new Point(targetmarginsize.X + 20.0, 200.0); lc.AddControl(form, new Point(30.0, 30.0)); } // Popup test { Label label = new Label("Right click for popup", Color.RGB(0.0, 0.3, 0.0), new LabelStyle() { HorizontalAlign = TextAlign.Center, VerticalAlign = TextAlign.Center, Wrap = TextWrap.Ellipsis }); PopupContainer pc = new PopupContainer(label); pc.ShowOnRightClick = true; pc.Items = new MenuItem[] { MenuItem.Create("Do nothing", delegate { }), MenuItem.Create("Remain inert", delegate { }), MenuItem.Create("Make a message box", delegate { MessageBox.ShowOKCancel(lc, "Message Box", "Done", null); }), MenuItem.Seperator, MenuItem.Create("Mouseover me!", new MenuItem[] { MenuItem.Create("Some", delegate { }), MenuItem.Create("Items", delegate { }), MenuItem.Create("Spawn", delegate { }), MenuItem.Create("Another", delegate { }), MenuItem.Create("Popup", delegate { }), }), MenuItem.Seperator, MenuItem.Create("Try", delegate { }), MenuItem.Create("The", delegate { }), MenuItem.Create("Keyboard", delegate { }), }; Form form = new Form(pc.WithAlign(label.SuggestSize, Align.Center, Align.Center).WithBorder(1.0), "Popup Test"); form.ClientSize = new Point(200.0, 50.0); lc.AddControl(form, new Point(230.0, 30.0)); form.AddCloseButton(); } // Timers and progress bars { FlowContainer flow = new FlowContainer(10.0, Axis.Vertical); Button addbutton = new Button("Add Some"); Button resetbutton = new Button("Reset"); Progressbar bar = new Progressbar(); flow.AddChild(addbutton, 30.0); flow.AddChild(resetbutton, 30.0); flow.AddChild(bar, 30.0); addbutton.Click += delegate { bar.Value = bar.Value + 0.05; }; resetbutton.Click += delegate { bar.Value = 0.0; }; MarginContainer margin = flow.WithMargin(20.0); Form form = new Form(margin.WithBorder(1.0), "Progress bars!"); form.ClientSize = margin.GetSize(new Point(200.0, flow.SuggestLength)) + new Point(4, 4); lc.AddControl(form, new Point(230.0, 150.0)); form.AddCloseButton(); } // Textbox { Textbox tb = new Textbox(); MarginContainer margin = tb.WithMargin(20.0); Form form = new Form(margin.WithBorder(1.0), "Change the title of this form!"); form.ClientSize = margin.GetSize(new Point(400.0, 32.0)); lc.AddControl(form, new Point(30.0, 360.0)); tb.TextChanged += delegate(string Text) { form.Text = Text; }; } return lc; }, "Lots of controls"); window.Run(); }
public static string TextRange(Progressbar bar) { return string.Format("{0} / {1}", bar.Value, bar.max); }
static void Main(string[] args) { var mainPanel = new Panel(); mainPanel.Name = "mainPanle"; mainPanel.Width = Application.STANDARD_ROOT_BOUNDARY.Width - 12; mainPanel.Height = Application.STANDARD_ROOT_BOUNDARY.Height - 6; mainPanel.Top = 3; mainPanel.Left = 6; #region Left Side var leftBox = new Groupbox(); leftBox.Name = "leftBox"; leftBox.Header = "Left Box"; leftBox.Top = leftBox.Left = 0; leftBox.Width = mainPanel.Width / 2; leftBox.Height = mainPanel.Height; var lblLeftStatus = new Label("Status:"); lblLeftStatus.Name = "lblLeftStatus"; lblLeftStatusText = new Label(); lblLeftStatusText.Name = "lblLeftStatusText"; lblLeftStatusText.Left = lblLeftStatus.Text.Length; lblLeftStatusText.Width = leftBox.Width - lblLeftStatus.Width; lblLeftStatusText.Align = ContentAlign.Right; var btnLeftIncrement = new Button("Increment"); btnLeftIncrement.Top = 1; btnLeftIncrement.Name = "btnLeftIncrement"; btnLeftIncrement.Pressed += BtnLeftIncrementOnPressed; var btnLeftClear = new Button("Clear"); btnLeftClear.Top = 2; btnLeftClear.Name = "btnLeftClear"; btnLeftClear.Pressed += (sender, eventArgs) => lblLeftStatusText.Text = ""; var txtLeftText = new Textbox(); txtLeftText.Text = "asd123"; txtLeftText.Top = 3; txtLeftText.Left = 21; txtLeftText.Width = 10; txtLeftText.BackColor = ConsoleColor.Gray; txtLeftText.ForeColor = ConsoleColor.Black; txtLeftText.Name = "txtLeftText"; txtLeftText.EnterPressed += (sender, eventArgs) => lblLeftStatusText.Text = txtLeftText.Text; var btnLeftSetText = new Button("Set this text =>"); btnLeftSetText.Top = 3; btnLeftSetText.Name = "btnLeftSetText"; btnLeftSetText.Pressed += (sender, eventArgs) => lblLeftStatusText.Text = txtLeftText.Text; var chkLeftMoveDir = new Checkbox("Move button up"); chkLeftMoveDir.Top = 5; chkLeftMoveDir.Left = 12; chkLeftMoveDir.Name = "chkLeftMoveDir"; chkLeftMoveDir.Checked = CheckState.Unchecked; var prgLeftMoveButton = new Progressbar(); prgLeftMoveButton.Top = 6; prgLeftMoveButton.Left = 12; prgLeftMoveButton.Name = "prgLeftMoveButton"; prgLeftMoveButton.Width = chkLeftMoveDir.Text.Length + 4; prgLeftMoveButton.Value = 10; var lblLeftPrgDesc = new Label(@"^ Progressbar ^"); lblLeftPrgDesc.Top = 7; lblLeftPrgDesc.Left = 14; lblLeftPrgDesc.Name = "lblLeftPrgDesc"; var myPlayground = new Playground(7, 14); myPlayground.Name = "playground"; myPlayground.Top = 9; myPlayground.Left = 14; myPlayground.BackColor = ConsoleColor.Blue; myPlayground.ForeColor = ConsoleColor.Red; myPlayground[0, 0] = 'x'; myPlayground[2, 2] = 'x'; myPlayground[4, 4] = 'x'; myPlayground[6, 6] = 'o'; myPlayground[4, 8] = 'x'; myPlayground[2, 10] = 'x'; myPlayground[0, 12] = 'x'; var btnLeftMove = new Button("Move"); btnLeftMove.Top = 4; btnLeftMove.Name = "btnLeftMove"; btnLeftMove.Pressed += (sender, eventArgs) => { var mv = chkLeftMoveDir.Checked == CheckState.Checked ? -1 : 1; if(btnLeftMove.Top + mv < btnLeftMove.Container.Height - 3 && btnLeftMove.Top + mv > 3) btnLeftMove.Top += mv; prgLeftMoveButton.Value = (int)(((btnLeftMove.Top - 2) / (float)(btnLeftMove.Container.Height - 6)) * 100); }; leftBox.Add(lblLeftStatus); leftBox.Add(lblLeftStatusText); leftBox.Add(btnLeftIncrement); leftBox.Add(btnLeftClear); leftBox.Add(btnLeftSetText); leftBox.Add(txtLeftText); leftBox.Add(btnLeftMove); leftBox.Add(chkLeftMoveDir); leftBox.Add(prgLeftMoveButton); leftBox.Add(lblLeftPrgDesc); leftBox.Add(myPlayground); #endregion #region Right Side var rightBox = new Groupbox(); rightBox.Name = "rightBox"; rightBox.Header = "Right Box"; rightBox.Top = 0; rightBox.Left = mainPanel.Width / 2; rightBox.Width = mainPanel.Width / 2; rightBox.Height = mainPanel.Height; var rightRightBox = new Groupbox(); rightRightBox.Name = "rightRightBox"; rightRightBox.Header = "Checkbox!"; rightRightBox.Top = 1; rightRightBox.Width = rightBox.Width / 2 - 2; rightRightBox.Height = 8; for (int i = 0; i < 4; i++) rightRightBox.Add(new Checkbox("Foo" + i) { Name = "foo" + i, Top = i }); var rightLeftBox = new Groupbox(); rightLeftBox.Name = "rightLeftBox"; rightLeftBox.Header = "Radiobutton!"; rightLeftBox.Top = 1; rightLeftBox.Left = rightBox.Width / 2 - 2; rightLeftBox.Width = rightBox.Width / 2 + 2; rightLeftBox.Height = 8; for (int i = 0; i < 4; i++) rightLeftBox.Add(new RadioButton("Bar" + i) { Name = "bar" + i, Top = i }); var lblRightRadioDesc = new Label("Radiobuttons can have groups:"); lblRightRadioDesc.Top = rightLeftBox.Height + 2; lblRightRadioDesc.Name = "lblDesc"; for (int i = 0; i < 6; i++) rightBox.Add(new RadioButton("asd" + i) { Text = "Group" + (i / 3), Name = "chk" + i.ToString(), Top = (i % 3) + rightRightBox.Height + 3, Left = (i / 3) * 15 + 2, ComboboxGroup = "grp" + (i / 3) }); rightBox.Add(rightRightBox); rightBox.Add(rightLeftBox); rightBox.Add(lblRightRadioDesc); #endregion mainPanel.Add(leftBox); mainPanel.Add(rightBox); var app = new Application(mainPanel); app.FocusManager = new FocusManager(mainPanel, btnLeftIncrement); app.Name = "FoggyConsole"; app.Run(); }
// Range: -1 Access: 0 Flags: ( 0, 4, 255 ) public static bool do_mob( dynamic user = null, dynamic target = null, double? time = null, bool? uninterruptible = null, bool? progress = null ) { bool _default = false; dynamic user_loc = null; bool drifting = false; dynamic target_loc = null; dynamic holding = null; Progressbar progbar = null; double endtime = 0; int starttime = 0; if ( time == null ) { time = 30; } if ( uninterruptible == null ) { uninterruptible = false; } if ( progress == null ) { progress = true; } if ( !Lang13.Bool( user ) || !Lang13.Bool( target ) ) { return false; } user_loc = user.loc; drifting = false; if ( !( ((BaseDynamic)user).Process_Spacemove( 0 ) != 0 ) && Lang13.Bool( user.inertia_dir ) ) { drifting = true; } target_loc = target.loc; holding = ((Mob)user).get_active_hand(); if ( progress == true ) { progbar = new Progressbar( user, time, target ); } endtime = Game13.time + ( time ??0); starttime = Game13.time; _default = true; while (Game13.time < endtime) { Task13.sleep( 1 ); if ( progress == true ) { progbar.update( Game13.time - starttime ); } if ( !Lang13.Bool( user ) || !Lang13.Bool( target ) ) { _default = false; break; } if ( uninterruptible == true ) { continue; } if ( drifting && !Lang13.Bool( user.inertia_dir ) ) { drifting = false; user_loc = user.loc; } if ( !drifting && user.loc != user_loc || target.loc != target_loc || ((Mob)user).get_active_hand() != holding || Lang13.Bool( ((dynamic)user).incapacitated() ) || Lang13.Bool( user.lying ) ) { _default = false; break; } } if ( progress == true ) { GlobalFuncs.qdel( progbar ); } return _default; }
public static string TextPercent(Progressbar bar) { return string.Format("{0:P0}", (float)bar.Value / bar.max); }
// Use this for initialization void Start() { timeProgressbar = GameObject.Find ("TimeProgressbar").GetComponent<Progressbar> (); timeProgressbar.Max = 100; textOnProgressBar = GameObject.FindGameObjectWithTag ("TextOnProgressBar").GetComponent<Text> (); textBelowProgressBar=GameObject.FindGameObjectWithTag ("TextbelowProgressBar").GetComponent<Text> (); moneyText = GameObject.FindGameObjectWithTag ("MoneyText").GetComponent<Text> (); UIdataScript = GameObject.Find ("ScriptContainer").GetComponent<UIdataImporter> (); moneyCanEarnPerDayText = GameObject.FindGameObjectWithTag ("MoneyEarnPerDayText").GetComponent<Text> (); timeIncreasingText = GameObject.Find ("IncreasingSpeedText").GetComponent<Text> (); // timeProgressbar.Value = 10; }
public static void Show() { if (layer) return; layer = Templates.GetDuplicate(key); layer.transform.SetParent(Global.MessageCanvas, false); layer.gameObject.SetActive(true); var rect = layer.GetComponent<RectTransform>(); rect.sizeDelta = new Vector2(Global.ReferenceResolution.x, Global.ReferenceResolution.y); rect.anchorMin = new Vector2(0.5f, 0.5f); rect.anchorMax = new Vector2(0.5f, 0.5f); rect.pivot = new Vector2(0.5f, 0.5f); rect.anchoredPosition = Vector3.zero; if (progressbar == null) { progressbar = Util.Get<Progressbar>(layer.gameObject, "Progressbar"); } if (textTips == null) { textTips = Util.Get<Text>(layer.gameObject, "TextTips"); } Stick(); isShow = true; }
partial void OnSetProgressbar(ref Progressbar value);