public void NextSelect() { if (Tabs == null) { return; } if (Tabs[TabIndex].Items == null || Tabs[TabIndex].Items.Length == 0) { return; } SelectIndex = MMWMath.Repeat(SelectIndex + 1, 0, Tabs[TabIndex].Items.Length - 1); }
public void PrevTab() { if (Tabs == null) { return; } TabIndex = MMWMath.Repeat(TabIndex - 1, 0, 1); if (Tabs[TabIndex].Items == null || Tabs[TabIndex].Items.Length == 0) { return; } SelectIndex = MMWMath.Clamp(SelectIndex, 0, Tabs[TabIndex].Items.Length - 1); }
protected override void Update(double deltaTime) { if (Input.IsKeyPressed(Key.Number1) && 0 < userData.MaxHotbatItemCount) { userData.ItemSelectIndex = 0; } if (Input.IsKeyPressed(Key.Number2) && 1 < userData.MaxHotbatItemCount) { userData.ItemSelectIndex = 1; } if (Input.IsKeyPressed(Key.Number3) && 2 < userData.MaxHotbatItemCount) { userData.ItemSelectIndex = 2; } if (Input.IsKeyPressed(Key.Number4) && 3 < userData.MaxHotbatItemCount) { userData.ItemSelectIndex = 3; } if (Input.IsKeyPressed(Key.Number5) && 4 < userData.MaxHotbatItemCount) { userData.ItemSelectIndex = 4; } if (Input.IsKeyPressed(Key.Number6) && 5 < userData.MaxHotbatItemCount) { userData.ItemSelectIndex = 5; } if (Input.IsKeyPressed(Key.Number7) && 6 < userData.MaxHotbatItemCount) { userData.ItemSelectIndex = 6; } if (Input.IsKeyPressed(Key.Number8) && 7 < userData.MaxHotbatItemCount) { userData.ItemSelectIndex = 7; } if (Input.IsKeyPressed(Key.Number9) && 8 < userData.MaxHotbatItemCount) { userData.ItemSelectIndex = 8; } if (Input.MouseWheel > 0) { userData.ItemSelectIndex = MMWMath.Repeat(userData.ItemSelectIndex + 1, 0, userData.MaxHotbatItemCount - 1); } if (Input.MouseWheel < 0) { userData.ItemSelectIndex = MMWMath.Repeat(userData.ItemSelectIndex - 1, 0, userData.MaxHotbatItemCount - 1); } }
protected override void Update(double deltaTime) { if (Pause) { return; } var dist = (Transform.WorldPosition - MMW.MainCamera.Transform.WorldPosition).Length; var interval = dist / (300.0 * Priority); if (interval > 0.2) { interval = 0.2; } time += deltaTime; frame += deltaTime * Speed; if (time >= interval) { time -= interval; Animator.Frame = MMWMath.Repeat((float)(frame * 30.0), 0.0f, maxframe); } if (setdelay > 0.0) { delay -= deltaTime; if (delay < 0.0) { delay = 0.0; } var rate = (float)(delay / setdelay); if (prevAnimName != null) { Animator.SetRate(prevAnimName, rate); } Animator.SetRate(animName, 1.0f - rate); if (delay == 0.0) { prevAnimName = animName; setdelay = 0.0; } } }