void Start() { /* * if (PlayerPrefs.GetInt("havefile") == 1 && SceneManager.GetActiveScene().name == PlayerPrefs.GetString("scenename"))//如果有存档,且在当前场景(当前场景判断是为了在测试时方便,只是暂时保留) * { * float x = PlayerPrefs.GetFloat("restartx"); * float y = PlayerPrefs.GetFloat("restarty"); * float z = PlayerPrefs.GetFloat("restartz"); * if (PlayerPrefs.HasKey("nowskill")) * { * skillIndex = PlayerPrefs.GetInt("nowskill"); * } * transform.position = new Vector3(x, y, z); * } */ //cc = gameObject.GetComponent<CharacterController>(); AttackArea.SetActive(false); rigid = gameObject.GetComponent <Rigidbody>(); is2dmode = false; //初始时是3d模式 attackDistance = AttackArea.GetComponent <BoxCollider>().size.z; //获取攻击距离 //获得能量条和血条 lifeValueBar = GameObject.Find("Canvas/Head/Life").GetComponent <ValueBar>(); EnergyValueBar = GameObject.Find("Canvas/Head/Energy").GetComponent <ValueBar>(); //设置生命值和能量值 ChangeEnergyValue(maxEnergy); ChangeLifeValue(maxLife); //显示血条 ShowStatus(); }
void InstantiateLIfeBar()//实例化血条 { //生成预制体 enemylife = Instantiate(onEnmyLife); //将该物体赋予目标脚本 enemylife.SetTarget(this.transform); enemylife.h_offset = lifebar_Height; //得到血条 lifeBar = enemylife.GetComponent <ValueBar>(); lifeBar.SetValue(thisLnx.lifeValue / thisLnx.maxLife); }
private void createBars() { this.bars = new List <ValueBar>(); foreach (Item item in this.world.economy.getUnlockedItems()) { // Add a bar, this ore has been unlocked ValueBar bar = GameObject.Instantiate(this._valueBarPrefab, this._barParent).GetComponent <ValueBar>(); bar.setItem(item); this.bars.Add(bar); } }
// Start is called before the first frame update void Start() { gameUI = GameObject.Find("gameUI").transform; skillPrefab = Resources.Load("Skills/Skill" + skillId + "/Skill") as GameObject; skillImage = Resources.Load("Skills/Skill" + skillId + "/Sprite") as GameObject; prefabManabar = Resources.Load("UI/Mana") as GameObject; manabar = Instantiate(prefabManabar, gameUI).GetComponent <ValueBar>(); manabar.SetMaxValue((int)CD); //castSkill = Instantiate(skillImage, gameUI).GetComponent<Button>(); //castSkill.onClick.AddListener(CastSkill); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.Inflate(Resource.Layout.KurumsalRenkSecBaseActivity, container, false); picker = view.FindViewById <ColorPicker>(Resource.Id.picker); //saturationBar = view.FindViewById<SaturationBar>(Resource.Id.saturationbar); valueBar = view.FindViewById <ValueBar>(Resource.Id.valuebar); //picker.AddSVBar(svBar); //picker.addOpacityBar(opacityBar); //picker.AddSaturationBar(saturationBar); picker.AddValueBar(valueBar); //To get the color var a = picker.Color; //To set the old selected color u can do it like this picker.OldCenterColor = picker.Color; // adds listener to the colorpicker which is implemented //in the activity picker.OnColorChangedListener = this; //to turn of showing the old color // picker.setShowOldCenterColor(false); //adding onChangeListeners to bars //opacitybar.setOnOpacityChangeListener(new OnOpacityChangeListener …); //valuebar.setOnValueChangeListener(new OnValueChangeListener …); //saturationBar.setOnSaturationChangeListener(new OnSaturationChangeListener …); mRecyclerView = view.FindViewById <RecyclerView>(Resource.Id.recyclerView1); mRecyclerView.HasFixedSize = true; new System.Threading.Thread(new System.Threading.ThreadStart(async delegate { await Task.Run(async delegate { await Task.Delay(1000); RekleriGetir(); }); })).Start(); return(view); }
protected override void OnSettingUp() { base.OnSettingUp(); Color yellow = Color.DARK_AMBER; Color blue = Color.BLUE; CheckBox cb1 = new CheckBox(new CheckBoxTemplate() { UpperLeftPos = new Point(1, 1), Label = yellow.DoForegroundCode() + " A check" + blue.DoBackgroundCode() + "box", MinimumWidth = 13, HasFrameBorder = false, //LabelAlignment = HorizontalAlignment.Center, Tooltip = "Testing" + blue.DoBackgroundCode() + " Tootlip" }); Button b1 = new Button(new ButtonTemplate() { UpperLeftPos = new Point(1, 2), Label = yellow.DoForegroundCode() + "A " + blue.DoBackgroundCode() + "button", MinimumWidth = 11, LabelAlignment = HorizontalAlignment.Center }); CheckBox cb3 = new CheckBox(new CheckBoxTemplate() { UpperLeftPos = new Point(1, 5), Label = yellow.DoForegroundCode() + "che" + Color.StopColorCode + "cbox 3", AutoSizeOverride = new Size(5, 3), HasFrameBorder = false, LabelAlignment = HorizontalAlignment.Center, CheckOnLeft = false, }); CheckBox cb4 = new CheckBox(new CheckBoxTemplate() { UpperLeftPos = new Point(1, 7), Label = "check4", HasFrameBorder = false, AutoSizeOverride = new Size(11, 1), LabelAlignment = HorizontalAlignment.Center, CheckOnLeft = false, }); ValueBar vb = new ValueBar(new ValueBarTemplate() { UpperLeftPos = new Point(1, 12), MaximumValue = 100, StartingValue = 50, MinimumBGIntensity = .3f, MinimumFGIntensity = .5f, Width = 15, Tooltip = "Testing Tooltip" }); Pigment p = new Pigment(0xffffff, 0x334455); AddControls(cb3); AddSchedule(new Schedule(Callback, 2)); }
private void UpdateValue(UAVCommons.UAVSingleParameter param) { if (param != null) { double min = 0; double max = 0; UAVSingleParameter p = selectedParameter; // Check if is Servo if ((selectedParameter is UAVStructure) && (((UAVStructure)selectedParameter).values.ContainsKey("Value"))) { p = ((UAVStructure)selectedParameter)["Value"]; } if ((p is UAVStructure) && (((UAVStructure)p)["Min"] != null)) { min = Convert.ToDouble(((UAVStructure)p)["Min"].Value.ToString()); } else { min = Convert.ToDouble(p.Min.ToString()); } if ((p is UAVStructure) && (((UAVStructure)p)["Max"] != null)) { max = Convert.ToDouble(((UAVStructure)p)["Max"].Value); } else { max = Convert.ToDouble(p.Max.ToString()); } double result = 0; if (Double.TryParse(Convert.ToString(param.Value), out result)) { if (output) { if (ValueBar.InvokeRequired) { ValueBar.Invoke((MethodInvoker) delegate { ValueBar.Minimum = Convert.ToDecimal(min); ValueBar.Maximum = Convert.ToDecimal(max); if ((Convert.ToDouble(param.Value) > min) && (Convert.ToDouble(param.Value) < max)) { ValueBar.Value = Convert.ToDecimal(Convert.ToDouble(param.Value)); } ValueBar.Refresh(); }); } else { ValueBar.Minimum = Convert.ToDecimal(min); ValueBar.Maximum = Convert.ToDecimal(max); if ((Convert.ToDouble(param.Value) > min) && (Convert.ToDouble(param.Value) < max)) { ValueBar.Value = Convert.ToDecimal(Convert.ToDouble(param.Value)); } ValueBar.Invalidate(); } } else { if (valueTracker.InvokeRequired) { valueTracker.Invoke((MethodInvoker) delegate { valueTracker.Maximum = Convert.ToDecimal(max); valueTracker.Minimum = Convert.ToDecimal(min); if ((Convert.ToDouble(param.Value) > min) && (Convert.ToDouble(param.Value) < max)) { valueTracker.Value = Convert.ToDecimal(Convert.ToDouble(param.Value)); } valueTracker.TickFrequency = 10; valueTracker.TickStyle = TickStyle.Both; }); valueTracker.Invalidate(); } else { // valueTracker.Value = Convert.ToDecimal(param.Value); valueTracker.TickFrequency = 10; valueTracker.TickStyle = TickStyle.Both; valueTracker.Maximum = Convert.ToDecimal(max); valueTracker.Minimum = Convert.ToDecimal(min); if ((param.DoubleValue > min) && (param.DoubleValue < max)) { valueTracker.Value = Convert.ToDecimal(param.Value); } valueTracker.Invalidate(); } } if (lbl_value.InvokeRequired) { // lbl_value.Invoke((MethodInvoker)(() => lbl_value.Text = param.Value.ToString())); tb_max.Invoke((MethodInvoker)(() => tb_max.Text = max.ToString())); tb_min.Invoke((MethodInvoker)(() => tb_min.Text = min.ToString())); // lbl_value.Invalidate(); } else { tb_max.Text = max.ToString(); tb_min.Text = min.ToString(); lbl_value.Text = param.Value.ToString(); lbl_value.Invalidate(); } } } }
private void Start() { gameUI = GameObject.Find("gameUI").transform; healthBar = Instantiate(Resources.Load("UI/Health") as GameObject, gameUI).GetComponent <ValueBar>(); healthBar.SetMaxValue(maxHealth); }