Inheritance: AutoSpriteControlBase
コード例 #1
0
		public void Include (UISlider slider)
		{
			slider.Value = slider.Value + 1;
			slider.ValueChanged += (sender, args) => {
				slider.Value = 1;
			};
		}
コード例 #2
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			Title = "Color Controls";
			View.BackgroundColor = UIColor.White;

			resetButton = UIButton.FromType (UIButtonType.RoundedRect);
			resetButton.Frame = new CGRect(110, 60, 90, 40);
			resetButton.SetTitle ("Reset", UIControlState.Normal);
			resetButton.TouchUpInside += (sender, e) => {
				sliderSaturation.Value = 1;	
				sliderBrightness.Value = 0;
				sliderContrast.Value = 1;
				HandleValueChanged (sender, e);
			};
			View.Add (resetButton);
	

			labelC = new UILabel(new CGRect(10, 110, 90, 20));
			labelS = new UILabel(new CGRect(10, 160, 90, 20));
			labelB = new UILabel(new CGRect(10, 210, 90, 20));

			labelC.Text = "Contrast";
			labelS.Text = "Saturation";
			labelB.Text = "Brightness";

			View.Add (labelC);
			View.Add (labelS);
			View.Add (labelB);

			sliderBrightness = new UISlider(new CGRect(100,  110, 210, 20));
			sliderSaturation = new UISlider(new CGRect(100, 160, 210, 20));
			sliderContrast = new UISlider(new CGRect(100, 210, 210, 20));
			
			// http://developer.apple.com/library/mac/#documentation/graphicsimaging/reference/CoreImageFilterReference/Reference/reference.html#//apple_ref/doc/filter/ci/CIColorControls
			// set min/max values on slider to match CIColorControls filter
			sliderSaturation.MinValue = 0;
			sliderSaturation.MaxValue = 2;
			sliderBrightness.MinValue = -1;
			sliderBrightness.MaxValue = 1;
			sliderContrast.MinValue = 0;
			sliderContrast.MaxValue = 4;
			// set default values
			sliderSaturation.Value = 1;
			sliderBrightness.Value = 0;
			sliderContrast.Value = 1;
			
			sliderContrast.TouchUpInside += HandleValueChanged;
			sliderSaturation.TouchUpInside += HandleValueChanged;
			sliderBrightness.TouchUpInside += HandleValueChanged;
			
			View.Add (sliderContrast);
			View.Add (sliderSaturation);
			View.Add (sliderBrightness);

			imageView = new UIImageView(new CGRect(10, 240, 300, 200));
			sourceImage = UIImage.FromFile ("clouds.jpg");
			imageView.Image = sourceImage;
			View.Add (imageView);
		}
コード例 #3
0
		public AppearanceViewController () {

		// Set the default appearance values
		UIButton.Appearance.TintColor = UIColor.LightGray;
		UIButton.Appearance.SetTitleColor(UIColor.FromRGB(0,127,14), UIControlState.Normal);
			
		UISlider.Appearance.ThumbTintColor = UIColor.Red;
		UISlider.Appearance.MinimumTrackTintColor = UIColor.Orange;
		UISlider.Appearance.MaximumTrackTintColor = UIColor.Yellow;
			
		UIProgressView.Appearance.ProgressTintColor = UIColor.Yellow;
		UIProgressView.Appearance.TrackTintColor = UIColor.Orange;



			btnBlack = UIButton.FromType(UIButtonType.System);
			btnBlue = UIButton.FromType(UIButtonType.System);
		slider = new UISlider(new CGRect(10,110,300, 30));
		slider2 = new UISlider(new CGRect(10,260,300, 30));

			// Wire up the buttons to the SampleCode class methods
			btnBlack.TouchUpInside += (sender, e) => {
				NavigationController.PushViewController (new BlackViewController(), true);				
			};
			btnBlue.TouchUpInside += (sender, e) => {
				NavigationController.PushViewController (new BlueViewController(), true);				
			};
		}
コード例 #4
0
    // Use this for initialization
    void Start()
    {



        factoryWindowMenuObject = GameObject.FindGameObjectWithTag("MenuFactory");
        taskWindowObject = factoryWindowMenuObject.transform.FindChild("TaskListWindow").gameObject;
        storageWindowData = GetComponent<StorageWindow>();
        drillMasterData = GetComponent<DrillMaster>();
        scanMasterData = GetComponent<ScanMaster>();
        taskWaitListWindowData = GetComponent<TaskWaitListWindow>();
        drillDictionary = drillMasterData.drillDictionary;
        scanDictionary = scanMasterData.scanDictionary;
        progressSlider = factoryWindowMenuObject.transform.FindChild("ProgressBarBuild").gameObject.GetComponent<UISlider>();

        GameObject drillDataObject = transform.FindChild("FactoryWindowData").gameObject.transform.FindChild("DrillData").gameObject;
        drillLabelType = drillDataObject.transform.FindChild("LabelDrillType").gameObject.GetComponent<UILabel>();
        drillLabelValue = drillDataObject.transform.FindChild("LabelDrillValue").gameObject.GetComponent<UILabel>();

        GameObject scanDataObject = transform.FindChild("FactoryWindowData").gameObject.transform.FindChild("ScanData").gameObject;
        scanLabelType = scanDataObject.transform.FindChild("LabelScanType").gameObject.GetComponent<UILabel>();
        scanLabelValue = scanDataObject.transform.FindChild("LabelScanValue").gameObject.GetComponent<UILabel>();

        GameObject pipesDataObject = transform.FindChild("FactoryWindowData").gameObject.transform.FindChild("PipesData").gameObject;
        //drillLabelType = drillDataObject.transform.FindChild("LabelDrillType").gameObject.GetComponent<UILabel>();
        pipesValue = pipesDataObject.transform.FindChild("LabelPipesValue").gameObject.GetComponent<UILabel>();

        GameObject kostenDataObject = transform.FindChild("FactoryWindowData").gameObject.transform.FindChild("LabelKosten").gameObject;
        //drillLabelType = drillDataObject.transform.FindChild("LabelDrillType").gameObject.GetComponent<UILabel>();
        costsValue = kostenDataObject.transform.FindChild("LabelKostenValue").gameObject.GetComponent<UILabel>();

        FactoryShow();
        FactoryWindowReload();
    } // END Start
コード例 #5
0
    void Awake()
    {
        globals = Globals.GetInstance();
        XPBarSlider = XPBarSliderGO.GetComponent<UISlider>();
        maxWidth = XPBarSlider.foreground.localScale.x;

        if(XPBarSlider == null)
        {
            Debug.LogError("Couldn't get the UISlider component in XPBar Script.");
        }

        XPMaximum = globals.XPMaximum;
        if(XPMaximum == 0)
        {
            globals.XPPoints = 0;
            PlayerPrefs.SetInt("XP", 0);
            XPMaximum = 100;
            globals.XPMaximum = 100;
            PlayerPrefs.SetInt("XPMaximum", 100);
            Debug.Log("This is the first time XP bar is used.");
        }

        //XPBar.pixelInset.width = globals.XPPoints / (globals.XPMaximum / 100);
        XPPoints = globals.XPPoints;
        UpdateDisplay((XPPoints / XPMaximum));
        player = GameObject.FindWithTag("Player");
    }
コード例 #6
0
ファイル: UIGameBottom.cs プロジェクト: kofight/CapsUnity
    public override void OnCreate()
    {
        base.OnCreate();

        for (int i = 0; i < 3; ++i )
        {
            m_starsSprites[i] = GetChildComponent<UISprite>("Star" + (i + 1));      //查找sprite
        }
        m_progressSprite = GetChildComponent<UISprite>("Progress");      //查找sprite

        stageBoard = GetChildComponent<UISprite>("StageBoard");

        m_speedSlider = GetChildComponent<UISlider>("SpeedSlider");
        m_speedLabel = GetChildComponent<UILabel>("SpeedLabel");

        m_timeBar = GetChildComponent<UISprite>("TimeBar");

        m_scoreDrawer = GetChildComponent<NumberDrawer>("ScoreDrawer");
        m_stepDrawer = GetChildComponent<NumberDrawer>("StepDrawer");

        m_timeNumber = UIToolkits.FindChild(mUIObject.transform, "TimeNumber").gameObject;
        m_minNumber = GetChildComponent<NumberDrawer>("MinNumber");
        m_secNumber = GetChildComponent<NumberDrawer>("SecNumber");

        m_stepChangeAnim = m_stepDrawer.GetComponent<Animation>();
        m_scoreChangeAnim = m_scoreDrawer.GetComponent<Animation>();

        m_hurryStepParticle = UIToolkits.FindChild(mUIObject.transform, "Effect_HurryStep").gameObject;
        m_hurryStepParticle.SetActive(false);

        m_hurryTimeParticle = UIToolkits.FindChild(mUIObject.transform, "Effect_HurryTime").gameObject;
        m_hurryTimeParticle.SetActive(false);
    }
コード例 #7
0
        public override void ViewDidAppear(bool animated)
        {
            base.ViewDidAppear (animated);

            this.View.BackgroundColor = UIColor.LightGray;

            txtSpeak = new UITextView (new RectangleF (20, 50, this.View.Bounds.Width - 40, 100));
            txtSpeak.Text = "Xamarin rocks!";
            this.View.AddSubview (txtSpeak);

            segAccent = new UISegmentedControl (new string[] {"US", "UK", "AUS" });
            segAccent.Frame = new RectangleF(20,160,this.View.Bounds.Width - 40, 50);
            segAccent.SelectedSegment = 0;
            this.View.AddSubview (segAccent);

            lblRate = new UILabel (new RectangleF (20, 230, 200, 20));
            lblRate.Text = "Rate";
            this.View.AddSubview (lblRate);

            sldRate = new UISlider(new RectangleF(20,250,this.View.Bounds.Width - 40, 50));
            sldRate.MinValue = 0;
            sldRate.MaxValue = 100;
            sldRate.Value = 75;

            this.View.AddSubview (sldRate);

            lblPitch = new UILabel (new RectangleF (20, 305, 200, 20));
            lblPitch.Text = "Pitch";
            this.View.AddSubview (lblPitch);

            sldPitch = new UISlider(new RectangleF(20,325,this.View.Bounds.Width - 40, 50));

            sldPitch.MinValue = 0;
            sldPitch.MaxValue = 100;
            sldPitch.Value = 75;

            this.View.AddSubview (sldPitch);

            btnSpeak = new UIButton (UIButtonType.RoundedRect);
            btnSpeak.Frame = new RectangleF (100, 375, this.View.Bounds.Width - 200, 30);
            btnSpeak.SetTitle ("Speak", UIControlState.Normal);

            btnSpeak.TouchDown += (object sender, EventArgs e) => {
                var speechSynthesizer = new AVSpeechSynthesizer ();
                var speechUtterance =
                    new AVSpeechUtterance (txtSpeak.Text);
                string lang = "en-US";

                if (segAccent.SelectedSegment == 1) lang = "en-GB";
                if (segAccent.SelectedSegment == 2) lang = "en-AU";

                speechUtterance.Voice = AVSpeechSynthesisVoice.FromLanguage (lang);
                speechUtterance.Rate = AVSpeechUtterance.MaximumSpeechRate * (sldRate.Value / 100);
                speechUtterance.PitchMultiplier = 2.0f * (sldPitch.Value / 100);

                speechSynthesizer.SpeakUtterance (speechUtterance);
            };

            this.View.AddSubview (btnSpeak);
        }
コード例 #8
0
 public override void OnInit()
 {
     base.OnInit();
     m_LabelProcess = FindChildComponent<UILabel>("UILabel_Process");
     m_LabelCurrentFile = FindChildComponent<UILabel>("UILabel_CurrentDownloadFile");
     m_SliderProcess = FindChildComponent<UISlider>("Slider");
 }
コード例 #9
0
		partial void volumeSet (UISlider sender)
		{
			if (player == null)
				return;
			
			player.Volume = sender.Value;
		}
コード例 #10
0
partial         void changedResonance(UISlider sender)
        {
            if (sender != resonanceSlider)
                return;

            resonanceParameter.Value = resonanceSlider.Value;
        }
コード例 #11
0
    void Start()
    {
        base.Start();
        nav = this.GetComponent<NavMeshAgent>();
        anim = this.GetComponent<Animator>();
        photonView = this.GetComponent<PhotonView>();
		myPlayerCam = NetworkManager.myChampionGO.transform.FindChild("Main Camera").camera;
		healthBar = prox.gameObject.transform.FindChild ("Progress Bar").gameObject.GetComponent<UISlider>();

        maxHealth = 50;
        health = maxHealth;
        attackDamage = Random.Range(5f, 10f);

        nav.speed = movementSpeed;
        nav.destination = destination;

        // Minion team text indicator
        GetComponentInChildren<TextMesh>().text = team.ToString();
        GetComponentInChildren<TextMesh>().color = (team == 0) ? Color.red : Color.blue;

        //Final destination for any minion is the base of the opponent team
        finalDestination = (team == 0) ? new Vector3(128, 14, 128) : new Vector3(-128, 14, -128);

		if (team == 0) {
			transform.FindChild("Indic").transform.renderer.material.color = Color.red;			
		} else {
			transform.FindChild("Indic").transform.renderer.material.color = Color.blue;
		}
    }
コード例 #12
0
		void ReleaseDesignerOutlets ()
		{
			if (CameraView != null) {
				CameraView.Dispose ();
				CameraView = null;
			}
			if (GrayCardButton != null) {
				GrayCardButton.Dispose ();
				GrayCardButton = null;
			}
			if (NoCamera != null) {
				NoCamera.Dispose ();
				NoCamera = null;
			}
			if (Segments != null) {
				Segments.Dispose ();
				Segments = null;
			}
			if (Temperature != null) {
				Temperature.Dispose ();
				Temperature = null;
			}
			if (Tint != null) {
				Tint.Dispose ();
				Tint = null;
			}
		}
コード例 #13
0
	void ValidatePivot (Transform fg, string name, UISlider.Direction dir)
	{
		if (fg != null)
		{
			UISprite sprite = fg.GetComponent<UISprite>();

			if (sprite != null && sprite.type != UISprite.Type.Filled)
			{
				if (dir == UISlider.Direction.Horizontal)
				{
					if (sprite.pivot != UIWidget.Pivot.Left &&
						sprite.pivot != UIWidget.Pivot.TopLeft &&
						sprite.pivot != UIWidget.Pivot.BottomLeft)
					{
						GUI.color = new Color(1f, 0.7f, 0f);
						GUILayout.Label(name + " should use a Left pivot");
						GUI.color = Color.white;
					}
				}
				else if (sprite.pivot != UIWidget.Pivot.BottomLeft &&
						 sprite.pivot != UIWidget.Pivot.Bottom &&
						 sprite.pivot != UIWidget.Pivot.BottomRight)
				{
					GUI.color = new Color(1f, 0.7f, 0f);
					GUILayout.Label(name + " should use a Bottom pivot");
					GUI.color = Color.white;
				}
			}
		}
	}
コード例 #14
0
        void AddSlider()
        {
            UISlider slider = new UISlider (new RectangleF (17, 370, 287, 10));

            slider.SetValue (0.5f, false);
            View.AddSubview (slider);
        }
コード例 #15
0
	void Awake()
	{
		uiSlider = GetComponentInChildren<UISlider>();
		uiSlider.value = 0;

		Bonus = new STowerBonus ();
	}
コード例 #16
0
		public override UITableViewCell GetCell (UITableView tv)
		{
			var cell = tv.DequeueReusableCell (CellKey);
			if (cell == null){
				cell = new UITableViewCell (UITableViewCellStyle.Default, CellKey);
				cell.SelectionStyle = UITableViewCellSelectionStyle.None;
			} else
				RemoveTag (cell, 1);

			SizeF captionSize = new SizeF (0, 0);
			if (Caption != null && ShowCaption){
				cell.TextLabel.Text = Caption;
				captionSize = cell.TextLabel.StringSize (Caption, UIFont.FromName (cell.TextLabel.Font.Name, UIFont.LabelFontSize));
				captionSize.Width += 10; // Spacing
			}

			if (slider == null){
				slider = new UISlider (new RectangleF (10f + captionSize.Width, 12f, 280f - captionSize.Width, 7f)){
					BackgroundColor = UIColor.Clear,
					MinValue = this.MinValue,
					MaxValue = this.MaxValue,
					Continuous = true,
					Value = this.Value,
					Tag = 1
				};
				slider.ValueChanged += delegate {
					Value = slider.Value;
				};
			} else {
				slider.Value = Value;
			}
			
			cell.ContentView.AddSubview (slider);
			return cell;
		}
コード例 #17
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();
            normalButton = GetButton (new CGRect (10, 120, 295, 48),
                                      FoodyTheme.SharedTheme.ButtonImage,
                                      "Standard Button");
            View.AddSubview (normalButton);

            pressedButton = GetButton (new CGRect (10, 190, 295, 48),
                                       FoodyTheme.SharedTheme.PressedButtonImage,
                                       "Button Pressed");
            View.AddSubview (pressedButton);

            label = new UILabel (new CGRect (15, 40, 400, 30));
            FoodyTheme.Apply (label);
            label.Text = "Label";
            View.AddSubview (label);

            var paddingView = new UIView (new CGRect (0, 0, 5, 20));
            TextField.LeftView = paddingView;
            TextField.LeftViewMode = UITextFieldViewMode.Always;
            TextField.ShouldReturn = TextFieldShouldReturn;
            TextField.Background = FoodyTheme.SharedTheme.TextFieldBackground;

            progress = new UIProgressView (new CGRect (13, 300, 292, 10));
            progress.Progress = 0.5f;
            View.AddSubview (progress);

            slider = new UISlider (new CGRect (10, 330, 298, 10));
            slider.Value = 0.5f;
            slider.ValueChanged += HandleValueChanged;
            View.AddSubview (slider);

            FoodyTheme.Apply (View);
        }
コード例 #18
0
	// Use this for initialization
	void Start ()
    {
        player = null;
        me = gameObject.GetComponent<UISlider>();
        value = 1.0f;
        RefreshHPLabel();
	}
コード例 #19
0
ファイル: EnemyController.cs プロジェクト: tsss-t/SimpleStory
    protected override void Start()
    {
        base.Start();
        HPMax = level * addHP + baseHP;
        ATK = level * addATK + baseATK;
        DEF = level * addDEF + baseDEF;
        HP = HPMax;
        if (HP == 0)
        {
            HP = level * 100;
        }


        positionStart = new Vector3(transform.position.x, transform.position.y, transform.position.z);
        if (nowState != ActionState.locked)
        {
            nowState = ActionState.notFoundPlayer;
        }

        timer = 0f;

        moveForward = new Vector2(transform.forward.x, transform.forward.z);


        //HPbar
        hpBarManagerUI = UIHpBarManager._instance;
        hpBar = hpBarManagerUI.CreateHpBar(transform.Find("HpBarPoint").gameObject);
        hpSlider = hpBar.transform.GetComponentInChildren<UISlider>();

        charaController = this.GetComponent<CharacterController>();
    }
コード例 #20
0
ファイル: TimeSlider.cs プロジェクト: dmantione/TimeWarp
        public override void Awake()
        {
            size = new Vector2(400, 100);

            anchor = UIAnchorStyle.Bottom & UIAnchorStyle.Left;
            backgroundSprite = "ButtonMenu";

            autoLayoutPadding = new RectOffset(10, 10, 4, 4);
            autoLayout = true;
            autoFitChildrenVertically = true;
            autoLayoutDirection = LayoutDirection.Vertical;

            timeOfDay = AddUIComponent<UILabel>();
            timeOfDay.textAlignment = UIHorizontalAlignment.Center;
            timeOfDay.size = new Vector2(width - 20, 20);
            timeOfDay.autoSize = false;

            timeSlider = UIFactory.CreateSlider(this, 0.0f, 24.0f);
            timeSlider.stepSize = 1f / 60.0f;
            timeSlider.eventValueChanged += ChangeTime;
            ((UIPanel)timeSlider.parent).backgroundSprite = "BudgetBarBackground";
            ((UISprite)timeSlider.thumbObject).spriteName = "InfoIconBasePressed";

            timeSlider.eventDragStart += timeSlider_eventDragStart;
            //timeSlider.eventDragEnd += timeSlider_eventDragEnd;

            eventMouseUp += timeSlider_eventDragEnd;

            UISprite pad = AddUIComponent<UISprite>();
            pad.autoSize = false;
            pad.size = new Vector2(10, 5);
        }
コード例 #21
0
        public CustomRecCell(NSString cellId)
            : base(UITableViewCellStyle.Default, cellId)
        {
            SelectionStyle = UITableViewCellSelectionStyle.Gray;

            fileNameLabel = new UILabel () {
                Font = UIFont.FromName("AmericanTypewriter", 15f),
                BackgroundColor = UIColor.Clear
            };

            playerPlayButton = new UIButton ();
            playerPlayButton.SetTitle("Play", UIControlState.Normal);
            playerPlayButton.SetTitle("Playing", UIControlState.Selected);
            playerPlayButton.Font = UIFont.FromName ("AmericanTypewriter", 15f);
            playerPlayButton.TouchUpInside += playerPlayButtonTouchUpInside_Event;

            playerStopButton = new UIButton ();
            playerStopButton.SetTitle("Stop", UIControlState.Normal);
            playerStopButton.Font = UIFont.FromName ("AmericanTypewriter", 15f);
            playerStopButton.TouchUpInside += playerStopButtonTouchUpInside_Event;

            progressBar = new UISlider ();
            progressBar.Enabled = false;
            progressBar.SetThumbImage (UIImage.FromBundle("Images/slider_thumb"), UIControlState.Normal);

            ContentView.Add (fileNameLabel);
            ContentView.Add (playerPlayButton);
            ContentView.Add (playerStopButton);
            ContentView.Add (progressBar);
        }
コード例 #22
0
ファイル: Settings.cs プロジェクト: henryj41043/TheUnseen
	public void InitAudio()
	{
		gameVolume = GameObject.Find("2DAudio").GetComponent<Volume>();
		
		if (GameObject.Find("musicSlider") != null &&
		    GameObject.Find("soundFXSlider")!= null &&
		    GameObject.Find("dialogueSlider") != null)
		{
			musicSlider = GameObject.Find("musicSlider").GetComponent<UISlider>();
			soundFXSlider = GameObject.Find("soundFXSlider").GetComponent<UISlider>();
			dialogueSlider = GameObject.Find("dialogueSlider").GetComponent<UISlider>();


			if (!PlayerPrefs.HasKey("MusicVol"))
				gameVolume.MusicVolume = musicSlider.value;
			else
				musicSlider.value = PlayerPrefs.GetFloat("MusicVol");
			
			if (!PlayerPrefs.HasKey("SoundFXVol"))
				gameVolume.AmbienceVolume = soundFXSlider.value;
			else
				soundFXSlider.value = PlayerPrefs.GetFloat("SoundFXVol");
			
			if (!PlayerPrefs.HasKey("DialogueVol"))
				gameVolume.AIVolume = dialogueSlider.value;
			else
				dialogueSlider.value = PlayerPrefs.GetFloat("DialogueVol");

		}

	}
コード例 #23
0
ファイル: UIGameBottom.cs プロジェクト: hiyijia/CapsUnity
    public override void OnCreate()
    {
        base.OnCreate();

        for (int i = 0; i < 3; ++i )
        {
            m_starsSprites[i] = GetChildComponent<UISprite>("Star" + (i + 1));      //查找sprite
        }
        m_progressSprite = GetChildComponent<UISprite>("Progress");      //查找sprite

        stageBoard = GetChildComponent<UISprite>("StageBoard");

        m_speedSlider = GetChildComponent<UISlider>("SpeedSlider");
        m_speedLabel = GetChildComponent<UILabel>("SpeedLabel");

        m_timeBar = GetChildComponent<UISprite>("TimeBar");

        m_scoreDrawer = GetChildComponent<NumberDrawer>("ScoreDrawer");
        m_stepDrawer = GetChildComponent<NumberDrawer>("StepDrawer");

        m_timeNumber = UIToolkits.FindChild(mUIObject.transform, "TimeNumber").gameObject;
        m_minNumber = GetChildComponent<NumberDrawer>("MinNumber");
        m_secNumber = GetChildComponent<NumberDrawer>("SecNumber");
        
    }
		public static void makeSettings(UIHelperBase helper) {
			UIHelperBase group = helper.AddGroup("Traffic Manager: President Edition (Settings are defined for each savegame separately)");
			simAccuracyDropdown = group.AddDropdown("Simulation accuracy (higher accuracy reduces performance):", new string[] { "Very high", "High", "Medium", "Low", "Very Low" }, simAccuracy, onSimAccuracyChanged) as UIDropDown;
			recklessDriversDropdown = group.AddDropdown("Reckless driving (BETA feature):", new string[] { "Path Of Evil (10 %)", "Rush Hour (5 %)", "Minor Complaints (2 %)", "Holy City (0 %)" }, recklessDrivers, onRecklessDriversChanged) as UIDropDown;
			relaxedBussesToggle = group.AddCheckbox("Busses may ignore lane arrows", relaxedBusses, onRelaxedBussesChanged) as UICheckBox;
#if DEBUG
			allRelaxedToggle = group.AddCheckbox("All vehicles may ignore lane arrows", allRelaxed, onAllRelaxedChanged) as UICheckBox;
#endif
			mayEnterBlockedJunctionsToggle = group.AddCheckbox("Vehicles may enter blocked junctions", mayEnterBlockedJunctions, onMayEnterBlockedJunctionsChanged) as UICheckBox;
			UIHelperBase groupAI = helper.AddGroup("Advanced Vehicle AI");
			advancedAIToggle = groupAI.AddCheckbox("Enable Advanced Vehicle AI", advancedAI, onAdvancedAIChanged) as UICheckBox;
			highwayRulesToggle = groupAI.AddCheckbox("Enable highway specific lane merging/splitting rules", highwayRules, onHighwayRulesChanged) as UICheckBox;
			laneChangingRandomizationDropdown = groupAI.AddDropdown("Drivers want to change lanes (only applied if Advanced AI is enabled):", new string[] { "Very often (50 %)", "Often (25 %)", "Sometimes (10 %)", "Rarely (5 %)", "Very rarely (2.5 %)", "Only if necessary" }, laneChangingRandomization, onLaneChangingRandomizationChanged) as UIDropDown;
//#if DEBUG
			UIHelperBase senseAI = helper.AddGroup("Avoidance of lanes with high traffic density (low - high)");
			carCityTrafficSensitivitySlider = senseAI.AddSlider("Cars, city:", 0f, 1f, 0.05f, carCityTrafficSensitivity, onCarCityTrafficSensitivityChange) as UISlider;
			carHighwayTrafficSensitivitySlider = senseAI.AddSlider("Cars, highway:", 0f, 1f, 0.05f, carHighwayTrafficSensitivity, onCarHighwayTrafficSensitivityChange) as UISlider;
			truckCityTrafficSensitivitySlider = senseAI.AddSlider("Trucks, city:", 0f, 1f, 0.05f, truckCityTrafficSensitivity, onTruckCityTrafficSensitivityChange) as UISlider;
			truckHighwayTrafficSensitivitySlider = senseAI.AddSlider("Trucks, highway:", 0f, 1f, 0.05f, truckHighwayTrafficSensitivity, onTruckHighwayTrafficSensitivityChange) as UISlider;
//#endif
			UIHelperBase group2 = helper.AddGroup("Maintenance");
			group2.AddButton("Forget toggled traffic lights", onClickForgetToggledLights);
			nodesOverlayToggle = group2.AddCheckbox("Show nodes and segments", nodesOverlay, onNodesOverlayChanged) as UICheckBox;
			showLanesToggle = group2.AddCheckbox("Show lanes", showLanes, onShowLanesChanged) as UICheckBox;
#if DEBUG
			pathCostMultiplicatorField = group2.AddTextfield("Pathcost multiplicator", String.Format("{0:0.##}", pathCostMultiplicator), onPathCostMultiplicatorChanged) as UITextField;
#endif
		}
コード例 #25
0
    // ###########################
	// Use this for initialization
	void Start () {

        researchMasterData = this.GetComponent<ResearchMaster>();
        researchTypeCount = researchMasterData.researchDictionary.Count;
        playerAttributeControlData = GameObject.Find("01_Player").GetComponent<PlayerAttributeControl>();

        researchWindowMenuObject = GameObject.FindGameObjectWithTag("MenuResearch");

        

        GameObject childHolder = gameObject.transform.FindChild("ResearchWindowData").gameObject;

        researchTimeLabel = childHolder.transform.FindChild("ResearchTime").gameObject.GetComponent<UILabel>();

        buttonSpeedLabel = childHolder.transform.FindChild("ButtonSpeed").gameObject.transform.FindChild("Label").gameObject.GetComponent<UILabel>();
        buttonAmountLabel = childHolder.transform.FindChild("ButtonAmount").gameObject.transform.FindChild("Label").gameObject.GetComponent<UILabel>();
        buttonDrillLabel = childHolder.transform.FindChild("ButtonDrill").gameObject.transform.FindChild("Label").gameObject.GetComponent<UILabel>();
        buttonBuildCostsLabel = childHolder.transform.FindChild("ButtonBuildCosts").gameObject.transform.FindChild("Label").gameObject.GetComponent<UILabel>();
        buttonDrillPlattformLabel = childHolder.transform.FindChild("ButtonDrillPlattform").gameObject.transform.FindChild("Label").gameObject.GetComponent<UILabel>();
        buttonScan = childHolder.transform.FindChild("ButtonScan").gameObject.transform.FindChild("Label").gameObject.GetComponent<UILabel>();

        progressbarSlider = gameObject.transform.FindChild("ResearchWindowData").gameObject.transform.FindChild("ProgressBarResearch").gameObject.transform.FindChild("Control - Colored Progress Bar").gameObject.GetComponent<UISlider>();

        ResearchShow();
	} // END Start
コード例 #26
0
ファイル: EquipMasterItem.cs プロジェクト: floatyears/Decrypt
 private void CreateObjects()
 {
     this.mEquipIconItem = CommonIconItem.Create(base.gameObject, new Vector3(-161f, 38f, 0f), null, false, 0.8f, null);
     this.mName = GameUITools.FindUILabel("Name", base.gameObject);
     this.mSlider = GameUITools.FindGameObject("Bar", base.gameObject).GetComponent<UISlider>();
     this.mValue = GameUITools.FindUILabel("Value", this.mSlider.gameObject);
 }
コード例 #27
0
        UIControl CustomSliderControl()
        {
            var cslider = new UISlider (new RectangleF (174f, 12f, 120f, 7f)){
                BackgroundColor = UIColor.Clear,
                MinValue = 0f,
                MaxValue = 100f,
                Continuous = true,
                Value = 50f,
                Tag = kViewTag
            };

            var left = UIImage.FromFile ("images/orangeslide.png");
            left = left.StretchableImage (10, 0);
            var right = UIImage.FromFile ("images/yellowslide.png");
            right = right.StretchableImage (10, 0);

            cslider.SetThumbImage (UIImage.FromFile ("images/slider_ball.png"), UIControlState.Normal);
            cslider.SetMinTrackImage (left, UIControlState.Normal);
            cslider.SetMaxTrackImage (right, UIControlState.Normal);

            cslider.ValueChanged += delegate {
                Console.WriteLine ("New value {0}", cslider.Value);
            };
            return cslider;
        }
コード例 #28
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();
            Title = "Slider";
            View.BackgroundColor = UIColor.White;
            label = new UILabel(new CGRect(10, 80, 90, 20));
            label.Text = "Value: ?";
            label2 = new UILabel(new CGRect(10, 140, 90, 20));
            label2.Text = "Value: ?";
            View.Add (label);
            View.Add (label2);

            sliderImage = new UISlider(new CGRect(100,  80, 210, 20));
            View.Add (sliderImage);

            sliderImage.SetThumbImage(UIImage.FromFile("29_icon.png"), UIControlState.Normal);

            sliderImage.MinValue = 0f;
            sliderImage.MaxValue = 1f;
            sliderImage.Value = 0.5f;
            sliderImage.ValueChanged += HandleValueChanged; // defined below

            sliderColor = new UISlider(new CGRect(100,  140, 210, 20));
            View.Add (sliderColor);
            sliderColor.Value = 0.25f;
            sliderColor.ThumbTintColor = UIColor.Red;
            sliderColor.MinimumTrackTintColor = UIColor.Orange;
            sliderColor.MaximumTrackTintColor = UIColor.Yellow;
            sliderColor.ValueChanged += HandleValueChanged2; // defined below
        }
コード例 #29
0
 private void CreateObjects()
 {
     this.mSchoolName = base.transform.Find("schoolName").GetComponent<UILabel>();
     this.mProgressBar = base.transform.Find("progressBar").GetComponent<UISlider>();
     this.mProgressTxt = this.mProgressBar.transform.Find("ExpText").GetComponent<UILabel>();
     this.mMaskGo = base.transform.Find("maskTip").gameObject;
     this.mMaskTip = this.mMaskGo.GetComponent<UILabel>();
     GameObject gameObject = this.mMaskGo.transform.Find("mask").gameObject;
     UIEventListener expr_A3 = UIEventListener.Get(gameObject);
     expr_A3.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(expr_A3.onClick, new UIEventListener.VoidDelegate(this.OnSchoolItemClick));
     this.mTipGo = base.transform.Find("tipGo").gameObject;
     this.mSucRewardNum = this.mTipGo.transform.Find("c").GetComponent<UILabel>();
     this.mTipEnd = base.transform.Find("tipEnd").gameObject;
     this.mMasterIcon = base.transform.Find("itemIcon").GetComponent<UISprite>();
     this.mQualityMask = base.transform.Find("qualityMask").GetComponent<UISprite>();
     this.mTipState = base.transform.Find("tipState").GetComponent<UILabel>();
     this.mTipRewardStatus = base.transform.Find("tipReward").GetComponent<UILabel>();
     this.mGoBtn = base.transform.Find("goBtn").gameObject;
     UIEventListener expr_1AC = UIEventListener.Get(this.mGoBtn);
     expr_1AC.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(expr_1AC.onClick, new UIEventListener.VoidDelegate(this.OnGoBtnClick));
     this.mNewMark = this.mGoBtn.transform.Find("newMark").gameObject;
     UIEventListener expr_1F8 = UIEventListener.Get(base.gameObject);
     expr_1F8.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(expr_1F8.onClick, new UIEventListener.VoidDelegate(this.OnSchoolItemClick));
     this.mItemBgSp = base.transform.GetComponent<UISprite>();
     GameUITools.UpdateUIBoxCollider(base.transform, 4f, false);
 }
コード例 #30
0
 private void CreateObjects()
 {
     Transform transform = base.transform.Find("victory");
     this.mVictorySprite = transform.Find("victorySprite").gameObject;
     this.mVictorySprite.transform.localScale = Vector3.zero;
     this.mOldHpProgress = Mathf.Clamp01(1f - GameUIManager.mInstance.uiState.GuildBossHp);
     this.mCurHpProgress = Mathf.Clamp01(1f - Globals.Instance.Player.GuildSystem.GetGuildBossData(Globals.Instance.Player.GuildSystem.Guild.AttackAcademyID1).HealthPct);
     this.mTextBg = transform.Find("textBg");
     this.mTextBg.transform.localScale = Vector3.zero;
     this.mProgressTxt = this.mTextBg.Find("progressNum").GetComponent<UILabel>();
     this.mProgressTxt.text = string.Format("{0:F}%", this.mOldHpProgress * 100f);
     this.mProgressBar = this.mProgressTxt.transform.Find("progressBar").GetComponent<UISlider>();
     this.mProgressBar.value = this.mOldHpProgress;
     this.mDamageLb = this.mTextBg.Find("scoreNum").GetComponent<UILabel>();
     this.mDamageLb.text = "0";
     this.mGoldLb = this.mTextBg.Find("goldTxt/goldNum").GetComponent<UILabel>();
     this.mGoldLb.text = "0";
     this.mKillerTip = this.mTextBg.Find("killerTxt").gameObject;
     this.mExNum = this.mKillerTip.transform.Find("num").GetComponent<UILabel>();
     this.mKillerTip.transform.localScale = Vector3.zero;
     this.mBtnGroup = base.transform.Find("ButtonGroup");
     GameObject gameObject = this.mBtnGroup.Find("sureBtn").gameObject;
     UIEventListener expr_20F = UIEventListener.Get(gameObject);
     expr_20F.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(expr_20F.onClick, new UIEventListener.VoidDelegate(this.OnSureBtnClick));
     this.mBtnGroup.localScale = Vector3.zero;
 }
コード例 #31
0
        private void CreateUI()
        {
            try
            {
                _zonePanel                  = UIUtils.CreatePanel("ZoneItZonePanel");
                _zonePanel.zOrder           = 0;
                _zonePanel.backgroundSprite = "GenericPanelLight";
                _zonePanel.color            = new Color32(96, 96, 96, 255);
                _zonePanel.size             = new Vector2(206f, 106f);
                _zonePanel.isVisible        = false;

                _zoneDragHandle                  = UIUtils.CreateDragHandle(_zonePanel, "ZoneDragHandle");
                _zoneDragHandle.size             = new Vector2(_zoneDragHandle.parent.width, _zoneDragHandle.parent.height);
                _zoneDragHandle.relativePosition = new Vector3(0f, 0f);
                _zoneDragHandle.eventMouseUp    += (component, eventParam) =>
                {
                    ModConfig.Instance.PanelPositionX = _zonePanel.absolutePosition.x;
                    ModConfig.Instance.PanelPositionY = _zonePanel.absolutePosition.y;
                    ModConfig.Instance.Save();
                };

                _zoneInnerPanel = UIUtils.CreatePanel(_zonePanel, "ZoneInnerPanel");
                _zoneInnerPanel.backgroundSprite = "GenericPanelLight";
                _zoneInnerPanel.color            = new Color32(206, 206, 206, 255);
                _zoneInnerPanel.size             = new Vector2(_zoneInnerPanel.parent.width - 16f, 66f);
                _zoneInnerPanel.relativePosition = new Vector3(8f, 8f);

                for (int i = 0; i < 5; i++)
                {
                    UIButton button = UIUtils.CreateButton(_zoneInnerPanel, "Button" + (i), (i).ToString());
                    button.objectUserData   = i;
                    button.tooltip          = $"Zone radius: {i}";
                    button.relativePosition = new Vector3(5f + i * 36f, 5f);
                    button.eventClick      += (component, eventParam) =>
                    {
                        if (!eventParam.used)
                        {
                            ModConfig.Instance.Cells = (int)button.objectUserData;
                            ModConfig.Instance.Save();

                            UpdateButtons(ModConfig.Instance.Cells);

                            eventParam.Use();
                        }
                    };

                    _zoneButtons[i] = button;
                }

                _zoneRowsSlider                    = UIUtils.CreateSlider(_zoneInnerPanel, "RowsSlider", -1, 8, ModConfig.Instance.Rows);
                _zoneRowsSlider.tooltip            = "Force number of rows in zone blocks";
                _zoneRowsSlider.size               = new Vector2(130f, 8f);
                _zoneRowsSlider.relativePosition   = new Vector3(15f, 48f);
                _zoneRowsSlider.eventValueChanged += (component, value) =>
                {
                    if (_zoneRowsLabel != null)
                    {
                        ModConfig.Instance.Rows = (int)value;
                        ModConfig.Instance.Save();

                        _zoneRowsLabel.text = value == -1 ? "Off" : value.ToString();
                    }
                };

                _zoneRowsLabel = UIUtils.CreateLabel(_zoneInnerPanel, "RowsLabel", ModConfig.Instance.Rows == -1 ? "Off" : ModConfig.Instance.Rows.ToString());
                _zoneRowsLabel.textAlignment     = UIHorizontalAlignment.Right;
                _zoneRowsLabel.verticalAlignment = UIVerticalAlignment.Top;
                _zoneRowsLabel.textColor         = new Color32(185, 221, 254, 255);
                _zoneRowsLabel.textScale         = 0.7058824f;
                _zoneRowsLabel.autoSize          = false;
                _zoneRowsLabel.size             = new Vector2(30f, 16f);
                _zoneRowsLabel.relativePosition = new Vector3(150f, 48f);

                _zoneAnarchyCheckBox                    = UIUtils.CreateCheckBox(_zonePanel, "AnarchyCheckBox", "Zone Anarchy", ModConfig.Instance.Anarchy);
                _zoneAnarchyCheckBox.tooltip            = "Enable Zone Anarchy to avoid any update of zone blocks";
                _zoneAnarchyCheckBox.size               = new Vector2(_zoneAnarchyCheckBox.parent.width - 16f, 16f);
                _zoneAnarchyCheckBox.relativePosition   = new Vector3(8f, 82f);
                _zoneAnarchyCheckBox.eventCheckChanged += (component, value) =>
                {
                    ModConfig.Instance.Anarchy = value;
                    ModConfig.Instance.Save();
                };

                UpdateUI();
            }
            catch (Exception e)
            {
                Debug.Log("[Zone It!] ModManager:CreateUI -> Exception: " + e.Message);
            }
        }
コード例 #32
0
ファイル: LegendDataSource.cs プロジェクト: l0vekobe0824/MDCC
        private void InitAdvanced()
        {
            //
            // Two images + custom control
            //
            LegendItem item3 = new LegendItem("Transparency", "", UITableViewCellStyle.Default, UITableViewCellAccessory.None);

            UISlider slider = new UISlider();

            slider.MaxValue = 100f;
            slider.Value    = 50f;
            slider.MinValue = 0f;
            slider.Frame    = new RectangleF(140, 9, 150, 23);

            slider.Value         = _parentController.chart.Chart.Legend.Transparency;
            slider.ValueChanged += delegate {
                _parentController.chart.Chart.Legend.Transparency = (int)slider.Value;
            };
            item3.ContentView = slider;

            // A switcher legend visible
            LegendItem item4    = new LegendItem("Visible", "", UITableViewCellStyle.Default, UITableViewCellAccessory.None);
            UISwitch   switcher = new UISwitch();

            item4.AccessoryView    = switcher;
            switcher.On            = _parentController.chart.Chart.Legend.Visible;
            switcher.ValueChanged += delegate {
                _parentController.chart.Chart.Legend.Visible = switcher.On;
            };

            // A switcher legend transparent
            LegendItem item5     = new LegendItem("Transparent", "", UITableViewCellStyle.Default, UITableViewCellAccessory.None);
            UISwitch   switcher2 = new UISwitch();

            item5.AccessoryView     = switcher2;
            switcher2.On            = _parentController.chart.Chart.Legend.Transparent;
            switcher2.ValueChanged += delegate {
                _parentController.chart.Chart.Legend.Transparent = switcher2.On;
            };

            // A switcher legend symbols visible
            LegendItem item6     = new LegendItem("Symbols", "", UITableViewCellStyle.Default, UITableViewCellAccessory.None);
            UISwitch   switcher3 = new UISwitch();

            item6.AccessoryView     = switcher3;
            switcher3.On            = _parentController.chart.Chart.Legend.Symbol.Visible;
            switcher3.ValueChanged += delegate {
                _parentController.chart.Chart.Legend.Symbol.Visible = switcher3.On;
            };

            // A switcher legend shadow visible
            LegendItem item7     = new LegendItem("Shadow", "", UITableViewCellStyle.Default, UITableViewCellAccessory.None);
            UISwitch   switcher4 = new UISwitch();

            item7.AccessoryView     = switcher4;
            switcher4.On            = _parentController.chart.Chart.Legend.Shadow.Visible;
            switcher4.ValueChanged += delegate {
                _parentController.chart.Chart.Legend.Shadow.Visible = switcher4.On;
            };

            // A switcher legend pen visible
            LegendItem item8     = new LegendItem("Pen Border", "", UITableViewCellStyle.Default, UITableViewCellAccessory.None);
            UISwitch   switcher5 = new UISwitch();

            item8.AccessoryView     = switcher5;
            switcher5.On            = _parentController.chart.Chart.Legend.Pen.Visible;
            switcher5.ValueChanged += delegate {
                _parentController.chart.Chart.Legend.Pen.Visible = switcher5.On;
            };

            _items.Add(item3);
            _items.Add(item4);
            _items.Add(item5);
            _items.Add(item6);
            _items.Add(item7);
            _items.Add(item8);
        }
コード例 #33
0
 partial void SliderSize_ValueChanged(UISlider sender)
 {
     fireworks.ScaleMax = sliderSize.Value;
 }
コード例 #34
0
ファイル: Linking.cs プロジェクト: benoitjadinon/Wires
        public static void All()
        {
            var x1 = new UIButton();

            x1.TouchUpInside += (s, e) => { };

            var x2 = new UISlider();

            x2.ValueChanged += (s, e) => { };

            var x3 = new UIStepper();

            x3.ValueChanged += (s, e) => { };

            var x4 = new UISwitch();

            x4.ValueChanged += (s, e) => { };

            var x5 = new UITextField();

            x5.Text            = x5.Text;
            x5.EditingChanged += (s, e) => { };

            var x6 = new UIView();

            x6.Hidden                 = x6.Hidden;
            x6.Frame                  = x6.Frame;
            x6.TintColor              = x6.TintColor;
            x6.BackgroundColor        = x6.BackgroundColor;
            x6.Alpha                  = x6.Alpha;
            x6.UserInteractionEnabled = x6.UserInteractionEnabled;

            var x7 = new UIViewController();

            x7.Title = x7.Title;

            var x8 = new UIDatePicker();

            x8.Date = x8.Date;

            var x9 = new UIProgressView();

            x9.Progress          = x9.Progress;
            x9.ProgressTintColor = x9.ProgressTintColor;
            x9.TrackTintColor    = x9.TrackTintColor;

            var x10 = new UIImageView();

            x10.Image = x10.Image;

            var x11 = new UILabel();

            x11.Text      = x11.Text;
            x11.TextColor = x11.TextColor;

            var x12 = new UISegmentedControl();

            x12.SelectedSegment = x12.SelectedSegment;

            var x13 = new UISlider();

            x13.Value    = x13.Value;
            x13.MaxValue = x13.MaxValue;
            x13.MinValue = x13.MinValue;

            var x14 = new UIStepper();

            x14.Value        = x14.Value;
            x14.MaximumValue = x14.MaximumValue;
            x14.MinimumValue = x14.MinimumValue;

            var x15 = new UISwitch();

            x15.On = x15.On;

            var x16 = new UITextView();

            x16.Text     = x16.Text;
            x16.Changed += (sender, e) => { };
        }
コード例 #35
0
 partial void SliderShift_ValueChanged(UISlider sender)
 {
     TranslateSquare();
 }
コード例 #36
0
        public UIRelationshipDialog()
            : base(UIDialogStyle.Standard | UIDialogStyle.Close, true)
        {
            Caption = GameFacade.Strings.GetString("f106", "10");
            //f_web_inbtn = 0x1972454856DDBAC,
            //f_web_outbtn = 0x3D3AEF0856DDBAC,

            InnerBackground          = new UIImage(GetTexture((ulong)0x7A400000001)).With9Slice(13, 13, 13, 13);
            InnerBackground.Position = new Vector2(15, 65);
            InnerBackground.SetSize(510, 230);
            AddAt(3, InnerBackground);

            ResultsBox = new UIListBox
            {
                Columns = new UIListBoxColumnCollection()
            };
            for (int i = 0; i < 3; i++)
            {
                ResultsBox.Columns.Add(new UIListBoxColumn()
                {
                    Width = 170
                });
            }
            ResultsBox.Position = new Vector2(25, 82);
            ResultsBox.SetSize(510, 230);
            ResultsBox.RowHeight          = 40;
            ResultsBox.NumVisibleRows     = 6;
            ResultsBox.SelectionFillColor = Color.TransparentBlack;
            Add(ResultsBox);

            var seat = new UIImage(GetTexture(0x19700000002))
            {
                Position = new Vector2(28, 28)
            };

            Add(seat);

            IncomingButton = new UIButton(GetTexture((ulong)0x1972454856DDBAC))
            {
                Position = new Vector2(33, 33),
                Tooltip  = GameFacade.Strings.GetString("f106", "12")
            };
            Add(IncomingButton);
            OutgoingButton = new UIButton(GetTexture((ulong)0x3D3AEF0856DDBAC))
            {
                Position = new Vector2(33, 33),
                Tooltip  = GameFacade.Strings.GetString("f106", "13")
            };
            Add(OutgoingButton);

            SearchBox = new UITextBox
            {
                Position = new Vector2(550 - 170, 37)
            };
            SearchBox.SetSize(150, 25);
            SearchBox.OnEnterPress += SearchBox_OnEnterPress;
            Add(SearchBox);

            SortLabel = new UILabel
            {
                Caption  = GameFacade.Strings.GetString("f106", "1"),
                Position = new Vector2(95, 30)
            };
            SortLabel.CaptionStyle      = SortLabel.CaptionStyle.Clone();
            SortLabel.CaptionStyle.Size = 8;
            Add(SortLabel);

            SearchLabel = new UILabel
            {
                Caption   = GameFacade.Strings.GetString("f106", "14"),
                Alignment = TextAlignment.Right,
                Position  = new Vector2(550 - 230, 38),
                Size      = new Vector2(50, 1)
            };
            Add(SearchLabel);

            SortFriendButton = new UIButton(GetTexture((ulong)0xCE300000001))
            {
                Tooltip  = GameFacade.Strings.GetString("f106", "2"),
                Position = new Vector2(95, 47)
            }; //gizmo_friendliestthumb = 0xCE300000001,
            Add(SortFriendButton);

            SortEnemyButton = new UIButton(GetTexture((ulong)0xCE600000001))
            {
                Tooltip = GameFacade.Strings.GetString("f106", "3")
            }; //gizmo_meanestthumb = 0xCE600000001,
            SortEnemyButton.Position = new Vector2(115, 47) + (new Vector2(17 / 2f, 14) - new Vector2(SortEnemyButton.Texture.Width / 8, SortEnemyButton.Texture.Height));
            Add(SortEnemyButton);

            SortAlmostFriendButton = new UIButton(GetTexture((ulong)0x31600000001))
            {
                Tooltip = GameFacade.Strings.GetString("f106", "4")
            }; //gizmo_top100defaultthumb = 0x31600000001,
            SortAlmostFriendButton.Position = new Vector2(135, 47)
                                              + (new Vector2(17 / 2f, 14) - new Vector2(SortAlmostFriendButton.Texture.Width / 8, SortAlmostFriendButton.Texture.Height));
            Add(SortAlmostFriendButton);

            SortAlmostEnemyButton = new UIButton(GetTexture((ulong)0xCE400000001))
            {
                Tooltip = GameFacade.Strings.GetString("f106", "5")
            }; //gizmo_infamousthumb = 0xCE400000001,
            SortAlmostEnemyButton.Position = new Vector2(155, 47)
                                             + (new Vector2(17 / 2f, 14) - new Vector2(SortAlmostEnemyButton.Texture.Width / 8, SortAlmostEnemyButton.Texture.Height));
            Add(SortAlmostEnemyButton);

            SortRoommateButton = new UIButton(GetTexture((ulong)0x4B700000001))
            {
                Tooltip = GameFacade.Strings.GetString("f106", "6")
            }; //ucp far zoom
            SortRoommateButton.Position = new Vector2(175, 47)
                                          + (new Vector2(17 / 2f, 14) - new Vector2(SortRoommateButton.Texture.Width / 8, SortRoommateButton.Texture.Height));
            Add(SortRoommateButton);

            //gizmo_scrollbarimg = 0x31000000001,
            //gizmo_scrolldownbtn = 0x31100000001,
            //gizmo_scrollupbtn = 0x31200000001,

            ResultsSlider = new UISlider
            {
                Orientation = 1,
                Texture     = GetTexture(0x31000000001),
                MinValue    = 0,
                MaxValue    = 2,

                X = 529,
                Y = 72
            };
            ResultsSlider.SetSize(0, 214f);
            Add(ResultsSlider);

            SliderUpButton = new UIButton(GetTexture(0x31200000001))
            {
                Position = new Vector2(526, 65)
            };
            Add(SliderUpButton);
            SliderDownButton = new UIButton(GetTexture(0x31100000001))
            {
                Position = new Vector2(526, 287)
            };
            Add(SliderDownButton);

            ResultsSlider.AttachButtons(SliderUpButton, SliderDownButton, 1f);
            ResultsBox.AttachSlider(ResultsSlider);

            SetSize(560, 320);

            SortFriendButton.OnButtonClick       += (btn) => ChangeOrderFunc(OrderFriendly);
            SortEnemyButton.OnButtonClick        += (btn) => ChangeOrderFunc(OrderEnemy);
            SortAlmostFriendButton.OnButtonClick += (btn) => ChangeOrderFunc(OrderAlmostFriendly);
            SortAlmostEnemyButton.OnButtonClick  += (btn) => ChangeOrderFunc(OrderAlmostEnemy);
            SortRoommateButton.OnButtonClick     += (btn) => ChangeOrderFunc(OrderRoommate);

            ChangeOrderFunc(OrderFriendly);

            IncomingButton.OnButtonClick += (btn) => SetOutgoing(false);
            OutgoingButton.OnButtonClick += (btn) => SetOutgoing(true);

            TargetIcon = new UIPersonButton
            {
                FrameSize = UIPersonButtonSize.SMALL,
                Position  = new Vector2(72, 35)
            };
            Add(TargetIcon);

            CloseButton.OnButtonClick += CloseButton_OnButtonClick;

            FriendLabel = new UILabel
            {
                Position = new Vector2(35, 292)
            };
            Add(FriendLabel);

            IncomingLabel = new UILabel
            {
                Position  = new Vector2(540 - 36, 292),
                Size      = new Vector2(1, 1),
                Alignment = TextAlignment.Right
            };
            Add(IncomingLabel);

            SetOutgoing(true);
        }
コード例 #37
0
ファイル: UISlider.cs プロジェクト: DeadMemphis/CLRMod
    private void Set(float input, bool force)
    {
        if (!this.mInitDone)
        {
            this.Init();
        }
        float num = Mathf.Clamp01(input);

        if (num < 0.001f)
        {
            num = 0f;
        }
        float sliderValue = this.sliderValue;

        this.rawValue = num;
        float num3 = this.sliderValue;

        if (force || (sliderValue != num3))
        {
            Vector3 mSize = (Vector3)this.mSize;
            if (this.direction == Direction.Horizontal)
            {
                mSize.x *= num3;
            }
            else
            {
                mSize.y *= num3;
            }
            if ((this.mFGFilled != null) && (this.mFGFilled.type == UISprite.Type.Filled))
            {
                this.mFGFilled.fillAmount = num3;
            }
            else if (this.foreground != null)
            {
                this.mFGTrans.localScale = mSize;
                if (this.mFGWidget != null)
                {
                    if (num3 > 0.001f)
                    {
                        this.mFGWidget.enabled = true;
                        this.mFGWidget.MarkAsChanged();
                    }
                    else
                    {
                        this.mFGWidget.enabled = false;
                    }
                }
            }
            if (this.thumb != null)
            {
                Vector3 localPosition = this.thumb.localPosition;
                if ((this.mFGFilled != null) && (this.mFGFilled.type == UISprite.Type.Filled))
                {
                    if (this.mFGFilled.fillDirection == UISprite.FillDirection.Horizontal)
                    {
                        localPosition.x = !this.mFGFilled.invert ? mSize.x : (this.mSize.x - mSize.x);
                    }
                    else if (this.mFGFilled.fillDirection == UISprite.FillDirection.Vertical)
                    {
                        localPosition.y = !this.mFGFilled.invert ? mSize.y : (this.mSize.y - mSize.y);
                    }
                    else
                    {
                        Debug.LogWarning("Slider thumb is only supported with Horizontal or Vertical fill direction", this);
                    }
                }
                else if (this.direction == Direction.Horizontal)
                {
                    localPosition.x = mSize.x;
                }
                else
                {
                    localPosition.y = mSize.y;
                }
                this.thumb.localPosition = localPosition;
            }
            current = this;
            if (((this.eventReceiver != null) && !string.IsNullOrEmpty(this.functionName)) && Application.isPlaying)
            {
                this.eventReceiver.SendMessage(this.functionName, num3, SendMessageOptions.DontRequireReceiver);
            }
            if (this.onValueChange != null)
            {
                this.onValueChange(num3);
            }
            current = null;
        }
    }
コード例 #38
0
ファイル: ConfigWndBtn.cs プロジェクト: tsinglee2009/Dczg
    // Use this for initialization
    void Start()
    {
        // Back
        if (gameObject.name == "btn_back")
        {
            UISprite sp = gameObject.transform.FindChild("Background").FindChild("Sprite").GetComponent <UISprite>();
            if (mTown)
            {
                sp.spriteName = "fhzh";
            }
            else
            {
                sp.spriteName = "fhsj";
            }

            if (mConfigTab == null)
            {
                mConfigTab = GameObject.Find("ConfigTab");
            }
        }

        // Sound
        if (gameObject.name == "sl_volume")
        {
            mSlider = GetComponent <UISlider>();
            EventDelegate.Add(mSlider.onChange, OnChange);
            string s = sdConfDataMgr.Instance().GetSetting("CFG_Volume");
            if (s == "")
            {
                s = "1.0";
            }
            mSlider.value = float.Parse(s);
        }
        if (gameObject.name == "tg_mute")
        {
            string s = sdConfDataMgr.Instance().GetSetting("CFG_Mute");
            if (s == "")
            {
                s = "0";
            }
            if (s == "1")
            {
                GetComponentInChildren <UISprite>().spriteName = "mute1";
                if (mSlider != null)
                {
                    mSlider.enabled = false;
                }
            }
            else
            {
                GetComponentInChildren <UISprite>().spriteName = "mute0";
            }
        }

        // Graphic
        if (gameObject.name == "tg_g_low")
        {
            string s = sdConfDataMgr.Instance().GetSetting("CFG_Graphic");
            mGraphic1 = gameObject.GetComponentInChildren <UISprite>();
            if (s == "0")
            {
                mGraphic1.spriteName = "btn1";
            }
            else
            {
                mGraphic1.spriteName = "btn1dis";
            }
        }
        else if (gameObject.name == "tg_g_mid")
        {
            string s = sdConfDataMgr.Instance().GetSetting("CFG_Graphic");
            if (s == "")
            {
                s = "1";
                sdConfDataMgr.Instance().SetSettingNoWrite("CFG_Graphic", "1");
            }
            mGraphic2 = gameObject.GetComponentInChildren <UISprite>();
            if (s == "1")
            {
                mGraphic2.spriteName = "btn1";
            }
            else
            {
                mGraphic2.spriteName = "btn1dis";
            }
        }
        else if (gameObject.name == "tg_g_high")
        {
            string s = sdConfDataMgr.Instance().GetSetting("CFG_Graphic");
            mGraphic3 = gameObject.GetComponentInChildren <UISprite>();
            if (s == "2")
            {
                mGraphic3.spriteName = "btn1";
            }
            else
            {
                mGraphic3.spriteName = "btn1dis";
            }
        }

        // Control
        if (gameObject.name == "tg_move1")
        {
            string s = sdConfDataMgr.Instance().GetSetting("CFG_Move");
            mControl1 = gameObject.GetComponentInChildren <UISprite>();
            if (s != "1")
            {
                mControl1.spriteName = "btn1";
            }
            else
            {
                mControl1.spriteName = "btn1dis";
            }
        }
        else if (gameObject.name == "tg_move2")
        {
            string s = sdConfDataMgr.Instance().GetSetting("CFG_Move");
            mControl2 = gameObject.GetComponentInChildren <UISprite>();
            if (s == "1")
            {
                mControl2.spriteName = "btn1";
            }
            else
            {
                mControl2.spriteName = "btn1dis";
            }
        }

        // Angle
        if (gameObject.name == "tg_camera1")
        {
            string s = sdConfDataMgr.Instance().GetSetting("CFG_Camera");
            mCamera1 = gameObject.GetComponentInChildren <UISprite>();
            if (s != "1")
            {
                mCamera1.spriteName = "btn1";
            }
            else
            {
                mCamera1.spriteName = "btn1dis";
            }
        }
        else if (gameObject.name == "tg_camera2")
        {
            string s = sdConfDataMgr.Instance().GetSetting("CFG_Camera");
            mCamera2 = gameObject.GetComponentInChildren <UISprite>();
            if (s == "1")
            {
                mCamera2.spriteName = "btn1";
            }
            else
            {
                mCamera2.spriteName = "btn1dis";
            }
        }
    }
コード例 #39
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            View.BackgroundColor = UIColor.White;

            titleLabel = new UILabel
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                Text          = "Title",
                Font          = UIFont.PreferredTitle1,
                TextAlignment = UITextAlignment.Center,
            };

            plusImage = new UIImageView
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                Image       = UIImage.FromBundle("Plus"),
                ContentMode = UIViewContentMode.ScaleAspectFit,
            };

            text1Label = new UILabel
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                Text          = "Subtitle",
                Font          = UIFont.PreferredTitle2,
                TextAlignment = UITextAlignment.Left,
            };

            text2Label = new UILabel
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                Text          = "Very long text",
                Font          = UIFont.PreferredBody,
                TextAlignment = UITextAlignment.Left,
            };

            text3Label = new UILabel
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                Text          = "Text",
                Font          = UIFont.PreferredFootnote,
                TextAlignment = UITextAlignment.Left,
            };

            button = new UIButton(UIButtonType.RoundedRect)
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                BackgroundColor = UIColor.LightGray,
            };
            button.SetTitle("Button", UIControlState.Normal);

            slider = new UISlider
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                MinValue = 0,
                MaxValue = 1,
                Value    = 0.5f,
            };

            View.AddSubviews(titleLabel, plusImage, text1Label, text2Label, text3Label, button, slider);

            var guide = View.SafeAreaLayoutGuide;

            NSLayoutConstraint.ActivateConstraints(new[]
            {
                titleLabel.TopAnchor.ConstraintEqualTo(guide.TopAnchor, 16),
                titleLabel.LeadingAnchor.ConstraintEqualTo(guide.LeadingAnchor, 8),
                titleLabel.TrailingAnchor.ConstraintEqualTo(guide.TrailingAnchor, -8),

                plusImage.TopAnchor.ConstraintEqualTo(titleLabel.BottomAnchor, 16),
                plusImage.LeadingAnchor.ConstraintEqualTo(guide.LeadingAnchor, 8),
                plusImage.WidthAnchor.ConstraintEqualTo(40),
                plusImage.BottomAnchor.ConstraintEqualTo(slider.BottomAnchor),

                text1Label.LeadingAnchor.ConstraintEqualTo(plusImage.TrailingAnchor, 16),
                text2Label.LeadingAnchor.ConstraintEqualTo(plusImage.TrailingAnchor, 16),
                text3Label.LeadingAnchor.ConstraintEqualTo(plusImage.TrailingAnchor, 16),

                text1Label.TopAnchor.ConstraintEqualTo(plusImage.TopAnchor),
                text2Label.TopAnchor.ConstraintEqualTo(text1Label.BottomAnchor, 8),
                text3Label.TopAnchor.ConstraintEqualTo(text2Label.BottomAnchor, 8),

                button.LeadingAnchor.ConstraintGreaterThanOrEqualTo(text1Label.TrailingAnchor, 16),
                button.LeadingAnchor.ConstraintGreaterThanOrEqualTo(text2Label.TrailingAnchor, 16),
                button.LeadingAnchor.ConstraintGreaterThanOrEqualTo(text3Label.TrailingAnchor, 16),
                button.WidthAnchor.ConstraintGreaterThanOrEqualTo(60),

                button.TopAnchor.ConstraintEqualTo(text1Label.TopAnchor),
                button.BottomAnchor.ConstraintEqualTo(text3Label.BottomAnchor),

                slider.TopAnchor.ConstraintEqualTo(text3Label.BottomAnchor, 8),
                slider.LeadingAnchor.ConstraintEqualTo(text1Label.LeadingAnchor),
                slider.TrailingAnchor.ConstraintEqualTo(button.TrailingAnchor),
            });
        }
コード例 #40
0
 /// <summary>
 /// Includes the specified uiSlider.
 /// </summary>
 /// <param name="uiSlider">The uiSlider.</param>
 public void Include(UISlider uiSlider)
 {
     uiSlider.Value         = uiSlider.Value + 1;
     uiSlider.ValueChanged += (sender, args) => { uiSlider.Value = 1; };
 }
コード例 #41
0
        public override void ViewDidLoad()
        {
            View.BackgroundColor = UIColor.White;
            base.ViewDidLoad();

            // ios7 layout
            if (RespondsToSelector(new Selector("edgesForExtendedLayout")))
            {
                EdgesForExtendedLayout = UIRectEdge.None;
            }

            var subTotal = new UITextField()
            {
                BorderStyle = UITextBorderStyle.RoundedRect
            };

            subTotal.KeyboardType = UIKeyboardType.DecimalPad;
            Add(subTotal);

            var seek = new UISlider()
            {
                MinValue = 0,
                MaxValue = 100,
            };

            Add(seek);

            var seekLabel = new UILabel();

            Add(seekLabel);

            var tipLabel = new UILabel();

            Add(tipLabel);

            var totalLabel = new UILabel();

            Add(totalLabel);

            var set = this.CreateBindingSet <TipView, TipViewModel>();

            set.Bind(subTotal).To(vm => vm.SubTotal);
            set.Bind(seek).To(vm => vm.Generosity);
            set.Bind(seekLabel).To(vm => vm.Generosity);
            set.Bind(tipLabel).To(vm => vm.Tip);
            set.Bind(totalLabel).To("SubTotal + Tip");
            set.Apply();

            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            var margin = 10;

            View.AddConstraints(
                subTotal.AtLeftOf(View, margin),
                subTotal.AtTopOf(View, margin),
                subTotal.AtRightOf(View, margin),

                seek.WithSameLeft(subTotal),
                seek.Below(subTotal, margin),
                seek.ToLeftOf(seekLabel, margin),
                seek.WithRelativeWidth(seekLabel, 3),

                seekLabel.WithSameRight(subTotal),
                seekLabel.WithSameTop(seek),

                tipLabel.Below(seek, margin),
                tipLabel.WithSameLeft(seek),
                tipLabel.WithSameWidth(totalLabel),

                totalLabel.WithSameTop(tipLabel),
                totalLabel.ToRightOf(tipLabel, margin),
                totalLabel.WithSameRight(subTotal)
                );
        }
コード例 #42
0
 public void Include(UISlider slider)
 {
     slider.Value         = slider.Value + 1;
     slider.ValueChanged += (sender, args) => { slider.Value = 1; };
 }
コード例 #43
0
        public override void ProcessActivity(WebRequest request, WebResponse response)
        {
            switch (request.SendValue)
            {
            case "AnimImage":

                var uiview = new UIView();
                uiview.Style.Width("80%");
                uiview.Src = new Uri("http://www.365lu.cn/UserResources/1usm4ih/1599785635641/red_packet_bg.png");

                uiview.Add("https://data.kukahome.com/css/images/logo.png", new UIStyle().Name("top", "-20%").Name("width", "25%").Name("border-radius", "50%").Name("border-width", "5%").Name("border-color", "#fff"));


                var style = new UIStyle().Name("top", "30%").Name("width", "30%");

                style.Name("clicked").Name("animation-name", "reverse");
                style.Name("animation-name", "scale");

                uiview.Add(new UIClick("Date").Send(request.Model, request.Command), new Uri("http://www.365lu.cn/UserResources/1usm4ih/1599785654433/icon_open_red_packet1.png"), style);

                uiview.Add("牛人啊,请玩红包", new UIStyle().Color(0xfff).Size(30).Name("width", "80%"));
                this.Context.Send("UIView", new WebMeta().Put("view", uiview), true);
                break;

            case "Date":
                this.AsyncDialog("D", "none");
                this.AsyncDialog("Datec", g =>
                {
                    return(UIDateDialog.CreateDialog("Time"));
                });
                return;;
            }
            var form  = request.SendValues ?? new UMC.Web.WebMeta();
            var start = Utility.IntParse(form["start"], 0);
            var limit = Utility.IntParse(form["limit"], 1000);

            if (form.ContainsKey("limit") == false)
            {
                this.Context.Send(new UISectionBuilder(request.Model, request.Command, request.Arguments)
                                  .RefreshEvent("Builder")
                                  .Builder(), true);
            }

            var videoSrc = new Uri("http://2449.vod.myqcloud.com/2449_22ca37a6ea9011e5acaaf51d105342e3.f20.mp4");
            var ui       = UISection.Create(new UITitle("Demo"));

            if (start == 0)
            {
                UIView coustomCell = new UIView("UMC_User");

                coustomCell.Style.Name("width", "50%");
                coustomCell.Src = new Uri("http://www.365lu.cn/UserResources/1usm4ih/1599785635641/red_packet_bg.png");
                coustomCell.Add("image", new Uri("http://www.365lu.cn/UserResources/1usm4ih/1599785654433/icon_open_red_packet1.png"), new UIStyle().Name("width", "20%").Name("animation-name", "reverse"));
                coustomCell.Add("Text", "你好啊,是不是很好呢", new UIStyle().Name("left", "10").AlignLeft());
                ui.Componen.Add(coustomCell);
                ui.UIHeader = new UIHeader().Coustom(coustomCell);
            }

            var footer = new UIFootBar();

            footer.AddText(new UIEventText("w磊").Style(new UIStyle().Fixed().BgColor().Name("margin", "10").Name("border-radius", "10")));
            ui.UIFootBar   = footer;
            footer.IsFixed = true;
            var uIIcon = new UIIconNameDesc(new UIIconNameDesc.Item('\uF02d', "知识创作", "1篇").Color(0x36a3f7));

            ui.Add(uIIcon);
            uIIcon.Button("图片动画", new UIClick("AnimImage").Send(request.Model, request.Command), 0x36a3f7);
            uIIcon.Style.Name("fixed", "true");
            var text = new UITextDesc(new WebMeta().Put("title", "TextDesc使用说明", "desc", "格式属性title、desc、tag", "tag", "122"));

            text.Click(Web.UIClick.Pager("Subject", "UIData", new UMC.Web.WebMeta().Put("Id", "UMC/Rows/TextDesc"), true));
            ui.Add(text);
            var cell = UICell.Create("UMC_User", new WebMeta().Put("Text", "失人啊").Put("image", "https://www.baidu.com/img/flexible/logo/pc/result.png"));

            cell.Style.Name("Text").Color(0x05d);
            ui.Add(cell);

            var imge = new UIImageTextDesc(new WebMeta().Put("title", "ImageTextDesc使用说明", "desc", "格式属性title、desc、tag", "tag", "122", "right", "right").Put("src", "https://data.kukahome.com/css/images/logo.png"));

            imge.Click(Web.UIClick.Pager("Subject", "UIData", new UMC.Web.WebMeta().Put("Id", "UMC/Rows/ImageTextDesc"), true));
            ui.Add(imge);
            var cmT = new UICMSImage("https://data.kukahome.com/css/images/logo.png");

            cmT.Style.Name("width", "60%").AlignLeft().Padding(10);
            ui.Add(cmT);

            var d = new UITextNameValue("Name", "Text", "Value ");

            d.Click(Web.UIClick.Pager("Subject", "UIData", new UMC.Web.WebMeta().Put("Id", "UMC/Rows/TextNameValue"), true));
            ui.Add(d);

            var img2e = new UIImageTextDescTime(new WebMeta().Put("tag", "I12", "text", "ImageTextDescTime组件", "desc", "desc格式", "time", "time格式", "right", "right").Put("src", "https://data.kukahome.com/css/images/logo.png"));

            img2e.Click(Web.UIClick.Pager("Subject", "UIData", new UMC.Web.WebMeta().Put("Id", "UMC/Rows/ImageTextDescTime"), true));
            ui.Add(img2e);

            UIImageTextValue imageTextValue = new UIImageTextValue("https://data.kukahome.com/css/images/logo.png", "ImageTextValue组件", "Value格式");

            imageTextValue.Click(Web.UIClick.Pager("Subject", "UIData", new UMC.Web.WebMeta().Put("Id", "UMC/Rows/ImageTextValue"), true));
            ui.Add(imageTextValue);


            UI ui3 = new UI("UI组件", "Value格式");

            ui3.Click(Web.UIClick.Pager("Subject", "UIData", new UMC.Web.WebMeta().Put("Id", "UMC/Rows/UI"), true));
            ui3.Icon('\uf013', 0x4CAF50);
            ui.Add(ui3);
            //UIIconNameDesc iconNameDesc = new UIIconNameDesc(new UIIconNameDesc.Item("UI组件", "desc"));
            ui.Add(new UIIconNameDesc(new UIIconNameDesc.Item("UI组件", "desc").Click(Web.UIClick.Pager("Subject", "UIData", new UMC.Web.WebMeta().Put("Id", "UMC/Rows/IconNameDesc"), true))));
            ui.Add(new UIIconNameDesc(new UIIconNameDesc.Item("https://data.kukahome.com/css/images/logo.png", "UI组件", "desc").Click(Web.UIClick.Pager("Subject", "UIData", new UMC.Web.WebMeta().Put("Id", "UMC/Rows/IconNameDesc"), true))));
            ui.Add(new UIIconNameDesc(new UIIconNameDesc.Item("https://data.kukahome.com/css/images/logo.png", "UI组件", "desc")
                                      .Click(Web.UIClick.Pager("Subject", "UIData", new UMC.Web.WebMeta().Put("Id", "UMC/Rows/IconNameDesc"), true))).Button("关注", Web.UIClick.Pager("Subject", "UIData", new UMC.Web.WebMeta().Put("Id", "UMC/Rows/IconNameDesc"), true), 0x1890ff));

            ui.Add(new UIIconNameDesc(new UIIconNameDesc.Item("https://data.kukahome.com/css/images/logo.png", "UI组件", "desc"), new UIIconNameDesc.Item("https://data.kukahome.com/css/images/logo.png", "UI组件", "desc").Click(Web.UIClick.Pager("Subject", "UIData", new UMC.Web.WebMeta().Put("Id", "UMC/Rows/IconNameDesc"), true))));
            var dis = new UIDiscount(Web.UIClick.Pager("Subject", "UIData", new UMC.Web.WebMeta().Put("Id", "UMC/Rows/IconNameDesc"), true));

            dis.Title("UIDiscount优惠券组件");
            dis.State("有效");
            dis.Value("5元");
            dis.Desc("超级优惠券");
            dis.Start("2020.12.1");
            dis.End("2020.12.1");
            ui.Add(dis);


            var look = new UICMSLook("https://data.kukahome.com/css/images/logo.png", "CMSLook组件", "desc");

            look.Click(Web.UIClick.Pager("Subject", "UIData", new UMC.Web.WebMeta().Put("Id", "UMC/Rows/IconNameDesc"), true));

            ui.Add(look);
            var v = new UISheet("UISheet组件");

            v.AddItem("CMSLook组件", "desc");
            v.AddItem("CMSLook组件", "desc", true);
            //  var look2 = new UIItemText("CMSLook组件", "desc");
            //  look2.Click(Web.UIClick.Pager("Subject", "UIData", new UMC.Web.WebMeta().Put("Id", "UMC/Rows/IconNameDesc"), true));

            ui.Add(v);

            var uiitems = new UIItems();

            uiitems.Add("https://data.kukahome.com/css/images/logo.png", "Title", "desc", 0xff2, 0xff0000);
            uiitems.Add("https://data.kukahome.com/css/images/logo.png", "Title", "desc", 0xff2, 0xff0000);
            uiitems.Add("https://data.kukahome.com/css/images/logo.png", "Title", "desc", 0xff2, 0xff0000);
            uiitems.Add("https://data.kukahome.com/css/images/logo.png", "UIItems", "UIItems");
            //uiitems.Add("https://data.kukahome.com/css/images/logo.png", "UIItems", "UIItems");
            //dis.Click()
            ui.Add(uiitems);
            UINineImage nineImage = new UINineImage();

            nineImage.Add("https://data.kukahome.com/css/images/logo.png");
            nineImage.Add("https://data.kukahome.com/css/images/logo.png");
            nineImage.Add("https://www.365lu.cn/css/images/center_left.svg");
            nineImage.Click(Web.UIClick.Pager("Subject", "UIData", new UMC.Web.WebMeta().Put("Id", "UMC/Rows/IconNameDesc"), true));
            ui.Add(nineImage);
            ui.Add(new Web.UI.UIIcon().Add(new UIEventText('\ue906', "Iicon").Badge("12323"), new UIEventText("Iicon").Src("https://data.kukahome.com/css/images/logo.png"), new UIEventText("Iicon").Src("https://data.kukahome.com/css/images/logo.png").Badge("1")));

            UITitleMore more = new UITitleMore("Slider");
            var         tab  = new UITabFixed();

            tab.Add("列组", "1");

            tab.Add("列组", "1");
            tab.Add("列组", "1");
            tab.Add("列组", "1");
            tab.Add("列组", "1");
            tab.Add("列组", "1");
            tab.Add("列组", "1");
            tab.Add("列组", "1");
            tab.Add("列组", "1");
            tab.Add("列组", "1");
            tab.Add("列组", "1");
            tab.Add("列组", "1");
            tab.Add("列组", "1");
            tab.Add("列组", "1");
            tab.Add("列组", "1");
            tab.Add(new UIClick()
            {
                Text = "在的呢"
            });
            ui.Add(tab);
            var cms = new UICMS(new WebMeta().Put("title", "列组"), videoSrc, "https://data.kukahome.com/css/images/logo.png");

            cms.Left("imy");
            cms.Right("imy");
            ui.Add(cms);
            var cmsImage = new UICMSImage(videoSrc, "https://data.kukahome.com/css/images/logo.png");

            cmsImage.Style.Name("width", "60%").AlignLeft();
            var ui2     = ui.NewSection().Add(more).Add(cmsImage);
            var seilder = new UISlider();

            seilder.Add(videoSrc, "https://data.kukahome.com/css/images/logo.png");
            //seilder.Add("https://data.kukahome.com/css/images/logo.png");/
            seilder.Small();
            ui2.Add(seilder);
            seilder = new UISlider(true);
            seilder.Add("https://data.kukahome.com/css/images/logo.png");
            seilder.Add("https://data.kukahome.com/css/images/logo.png");
            // seilder.Small();
            ui2.Add(seilder);
            seilder = new UISlider();
            seilder.Add("https://data.kukahome.com/css/images/logo.png");
            //seilder.Add("https://data.kukahome.com/css/images/logo.png");
            seilder.Row();
            ui2.Add(seilder);
            UITextItems textItems = new UITextItems();

            textItems.Add(new UIEventText("232323").Style(new UIStyle().BgColor()), new UIEventText("安装").Style(new UIStyle().BgColor()), new UIEventText("安装"), new UIEventText("安装"));
            textItems.Add(new UIEventText("232323"), new UIEventText("安装"), new UIEventText("安装"), new UIEventText("sdsdsfsdfsdfsd").Style(new UIStyle().BgColor()));
            textItems.Add(new UIEventText("232323").Style(new UIStyle().BgColor()), new UIEventText("dsdsd"), new UIEventText("sdsdsd"), new UIEventText("sdsdsd").Style(new UIStyle().BgColor()));

            ui2.Add(textItems);
            UIButton button = new UIButton();

            button.Button(new UIEventText("安装").Badge("1d"));
            button.Style.AlignCenter();
            ui.NewSection().Add(button);
            ui.Title.Right(new UIEventText('\uf2e1', "33d").Click(new UIClick()
            {
                Key = "Float"
            }));                                                                                    //.Badge("21"));
            response.Redirect(ui);
        }
コード例 #44
0
ファイル: UISlider.cs プロジェクト: dn00/dexCube
    /// <summary>
    /// Update the visible slider.
    /// </summary>

    void Set(float input, bool force)
    {
        if (!mInitDone)
        {
            Init();
        }

        // Clamp the input
        float val = Mathf.Clamp01(input);

        if (val < 0.001f)
        {
            val = 0f;
        }

        float prevStep = sliderValue;

        // Save the raw value
        rawValue = val;

        // Take steps into account
        float stepValue = sliderValue;

        // If the stepped value doesn't match the last one, it's time to update
        if (force || prevStep != stepValue)
        {
            Vector3 scale = mSize;

#if UNITY_EDITOR
            if (Application.isPlaying)
            {
                if (direction == Direction.Horizontal)
                {
                    scale.x *= stepValue;
                }
                else
                {
                    scale.y *= stepValue;
                }
            }
#else
            if (direction == Direction.Horizontal)
            {
                scale.x *= stepValue;
            }
            else
            {
                scale.y *= stepValue;
            }
#endif

#if UNITY_EDITOR
            if (Application.isPlaying)
#endif
            {
                if (mFGFilled != null && mFGFilled.type == UISprite.Type.Filled)
                {
                    mFGFilled.fillAmount = stepValue;
                }
                else if (foreground != null)
                {
                    mFGTrans.localScale = scale;

                    if (mFGWidget != null)
                    {
                        if (stepValue > 0.001f)
                        {
                            mFGWidget.enabled = true;
                            mFGWidget.MarkAsChanged();
                        }
                        else
                        {
                            mFGWidget.enabled = false;
                        }
                    }
                }
            }

            if (thumb != null)
            {
                Vector3 pos = thumb.localPosition;

                if (mFGFilled != null && mFGFilled.type == UISprite.Type.Filled)
                {
                    if (mFGFilled.fillDirection == UISprite.FillDirection.Horizontal)
                    {
                        pos.x = mFGFilled.invert ? mSize.x - scale.x : scale.x;
                    }
                    else if (mFGFilled.fillDirection == UISprite.FillDirection.Vertical)
                    {
                        pos.y = mFGFilled.invert ? mSize.y - scale.y : scale.y;
                    }
                    else
                    {
                        Debug.LogWarning("Slider thumb is only supported with Horizontal or Vertical fill direction", this);
                    }
                }
                else if (direction == Direction.Horizontal)
                {
                    pos.x = scale.x;
                }
                else
                {
                    pos.y = scale.y;
                }
                thumb.localPosition = pos;
            }

            current = this;

            if (eventReceiver != null && !string.IsNullOrEmpty(functionName) && Application.isPlaying)
            {
                eventReceiver.SendMessage(functionName, stepValue, SendMessageOptions.DontRequireReceiver);
            }
            if (onValueChange != null)
            {
                onValueChange(stepValue);
            }
            current = null;
        }
    }
コード例 #45
0
        public override UITableViewCell GetCell(UITableView tv)
        {
            var cell = tv.DequeueReusableCell(CellKey);

            if (cell == null)
            {
                cell = new UITableViewCell(UITableViewCellStyle.Default, CellKey);
                cell.SelectionStyle = UITableViewCellSelectionStyle.None;
            }
            else
            {
                RemoveTag(cell, 1);
            }

            CGSize captionSize = new CGSize(0, 0);

            if (ShowCaption && (Caption != null || ReserveCaptionPlaceholderString != null || UseCaptionForValueDisplay))
            {
                if (Caption == null)
                {
                    if (UseCaptionForValueDisplay)
                    {
                        NSString           str        = new NSString(MaxValue.ToString());
                        UIStringAttributes attributes = new UIStringAttributes();
                        attributes.Font = UIFont.FromName(cell.TextLabel.Font.Name, UIFont.LabelFontSize);
                        captionSize     = str.GetSizeUsingAttributes(attributes);
                    }
                    else if (!string.IsNullOrEmpty(ReserveCaptionPlaceholderString))
                    {
                        NSString           str        = new NSString(ReserveCaptionPlaceholderString);
                        UIStringAttributes attributes = new UIStringAttributes();
                        attributes.Font = UIFont.FromName(cell.TextLabel.Font.Name, UIFont.LabelFontSize);
                        captionSize     = str.GetSizeUsingAttributes(attributes);
                    }
                }
                else
                {
                    NSString           str        = new NSString(Caption);
                    UIStringAttributes attributes = new UIStringAttributes();
                    attributes.Font = UIFont.FromName(cell.TextLabel.Font.Name, UIFont.LabelFontSize);
                    captionSize     = str.GetSizeUsingAttributes(attributes);
                }

                captionSize.Width += 10; // Spacing

                if (Caption != null)
                {
                    cell.TextLabel.Text = Caption;
                }
            }

            var lockImageWidth = _lockable ? LockImageWidth : 0;

            CGSize deviceSize = DeviceSize();
            CGRect sliderRect = new CGRect(10f + captionSize.Width, 0f,
                                           deviceSize.Width - captionSize.Width - lockImageWidth - 20f,
                                           cell.Frame.Height);

            if (_slider == null)
            {
                _slider = new UISlider(sliderRect)
                {
                    BackgroundColor = UIColor.Clear,
                    MinValue        = this.MinValue,
                    MaxValue        = this.MaxValue,
                    Continuous      = this.Continuous,
                    Value           = this.Value,
                    Tag             = 1
                };
                _slider.ValueChanged += delegate {
                    Value = (int)_slider.Value;
                    if (UseCaptionForValueDisplay)
                    {
                        Caption = Value.ToString();
                        // force repaint/redraw
                        if (GetContainerTableView() != null)
                        {
                            var root = GetImmediateRootElement();
                            root.Reload(this, UITableViewRowAnimation.None);
                        }
                    }
                    if (_valueChangedCallback != null)
                    {
                        _valueChangedCallback(Value);
                    }
                };
            }
            else
            {
                _slider.Value = Value;
                _slider.Frame = sliderRect;
            }

            if (_lockable)
            {
                if (_lockImageView == null)
                {
                    _lockImageView = new UIButton(new CGRect(_slider.Frame.X + _slider.Frame.Width, 2f, lockImageWidth, LockImageHeight));
                }

                _lockImageView.SetBackgroundImage((_valueLocked) ? LockImage : UnlockImage, UIControlState.Normal);
                _lockImageView.TouchUpInside += (object sender, EventArgs e) => {
                    _valueLocked = !_valueLocked;
                    _lockImageView.SetBackgroundImage((_valueLocked) ? LockImage : UnlockImage, UIControlState.Normal);
                    if (_valueLocked)
                    {
                        _slider.Enabled = (!_valueLocked);
                    }
                };
                cell.ContentView.AddSubview(_lockImageView);
            }
            cell.ContentView.AddSubview(_slider);
            return(cell);
        }
コード例 #46
0
 partial void accuracyChanged(UISlider sender)
 {
     AccuracyValue = (int)accuracyValue.Value;
 }
コード例 #47
0
ファイル: UIOptions.cs プロジェクト: HarryFreeMyLand/newso
        public UIGraphicOptions()
        {
            var script = RenderScript("graphicspanel.uis");

            UIEffectsLabel.Caption       = GameFacade.Strings.GetString("f103", "2");
            UIEffectsLabel.Alignment     = TextAlignment.Middle;
            CharacterDetailLabel.Caption = GameFacade.Strings.GetString("f103", "4");
            TerrainDetailLabel.Caption   = GameFacade.Strings.GetString("f103", "1");
            ShadowsLabel.Caption         = GameFacade.Strings.GetString("f103", "6");
            LightingLabel.Caption        = GameFacade.Strings.GetString("f103", "3");

            AntiAliasCheckButton.OnButtonClick     += new ButtonClickDelegate(FlipSetting);
            ShadowsCheckButton.OnButtonClick       += new ButtonClickDelegate(FlipSetting);
            LightingCheckButton.OnButtonClick      += new ButtonClickDelegate(FlipSetting);
            UIEffectsCheckButton.OnButtonClick     += new ButtonClickDelegate(FlipSetting);
            EdgeScrollingCheckButton.OnButtonClick += new ButtonClickDelegate(FlipSetting);

            ShadowsCheckButton.Tooltip   = ShadowsLabel.Caption;
            LightingCheckButton.Tooltip  = LightingLabel.Caption;
            UIEffectsCheckButton.Tooltip = UIEffectsLabel.Caption;

            CharacterDetailLowButton.OnButtonClick  += new ButtonClickDelegate(ChangeShadowDetail);
            CharacterDetailMedButton.OnButtonClick  += new ButtonClickDelegate(ChangeShadowDetail);
            CharacterDetailHighButton.OnButtonClick += new ButtonClickDelegate(ChangeShadowDetail);

            TerrainDetailLowButton.OnButtonClick  += new ButtonClickDelegate(ChangeSurroundingDetail);
            TerrainDetailMedButton.OnButtonClick  += new ButtonClickDelegate(ChangeSurroundingDetail);
            TerrainDetailHighButton.OnButtonClick += new ButtonClickDelegate(ChangeSurroundingDetail);

            TerrainDetailLowButton.Tooltip  = GameFacade.Strings.GetString("f103", "8");
            TerrainDetailMedButton.Tooltip  = GameFacade.Strings.GetString("f103", "9");
            TerrainDetailHighButton.Tooltip = GameFacade.Strings.GetString("f103", "10");

            Wall3DButton = new UIButton(AntiAliasCheckButton.Texture)
            {
                Position = AntiAliasCheckButton.Position + new Vector2(110, 0)
            };
            Wall3DButton.OnButtonClick += new ButtonClickDelegate(FlipSetting);
            Add(Wall3DButton);
            Wall3DLabel = new UILabel
            {
                Caption      = GameFacade.Strings.GetString("f103", FSOEnvironment.Enable3D ? "12" : "11"),
                CaptionStyle = UIEffectsLabel.CaptionStyle,
                Position     = AntiAliasCheckButton.Position + new Vector2(134, 0)
            };
            Add(Wall3DLabel);
            Wall3DButton.Visible = FSOEnvironment.Enable3D;
            Wall3DLabel.Visible  = FSOEnvironment.Enable3D;

            //switch lighting and uieffects label. replace lighting check with a slider

            var ltLoc = LightingLabel.Position;

            LightingLabel.Position  = UIEffectsLabel.Position;
            UIEffectsLabel.Position = ltLoc;
            ltLoc = LightingCheckButton.Position;
            LightingCheckButton.Position  = UIEffectsCheckButton.Position;
            UIEffectsCheckButton.Position = ltLoc;
            LightingCheckButton.Visible   = false;

            LightingSlider = new UISlider
            {
                Orientation   = 0,
                Texture       = GetTexture(0x42500000001),
                MinValue      = 0f,
                MaxValue      = 3f,
                AllowDecimals = false,
                Position      = LightingCheckButton.Position + new Vector2(96, 4)
            };
            LightingSlider.SetSize(96f, 0f);
            Add(LightingSlider);
            LightingLabel.X -= 24;

            SettingsChanged();

            LightingSlider.OnChange += (elem) =>
            {
                if (InternalChange)
                {
                    return;
                }
                var settings = GlobalSettings.Default;
                settings.LightingMode = (int)LightingSlider.Value;
                GlobalSettings.Default.Save();
                SettingsChanged();
            };
        }
コード例 #48
0
        private void SetSliders()
        {
            var y          = DisplayHelper.Is4InchDisplay() ? 40f : 35f;
            var sliderSize = new SizeF(320f - 135f, 20f);
            var sliderX    = 55f;

            _sliderR               = new UISlider(new RectangleF(new PointF(sliderX, 270f), sliderSize));
            _sliderR.MaxValue      = 255;
            _sliderR.MinValue      = 0;
            _sliderR.Value         = 255;
            _sliderR.ValueChanged += Slider_ValueChanged;
            this.View.AddSubview(_sliderR);

            _sliderG               = new UISlider(new RectangleF(new PointF(sliderX, 270f + y), sliderSize));
            _sliderG.MaxValue      = 255;
            _sliderG.MinValue      = 0;
            _sliderG.ValueChanged += Slider_ValueChanged;
            this.View.AddSubview(_sliderG);

            _sliderB               = new UISlider(new RectangleF(new PointF(sliderX, 270f + (y * 2)), sliderSize));
            _sliderB.MaxValue      = 255;
            _sliderB.MinValue      = 0;
            _sliderB.ValueChanged += Slider_ValueChanged;
            this.View.AddSubview(_sliderB);

            var labelX    = 40f;
            var labelSize = new SizeF(20f, 20f);

            var labelR = new UILabel(new RectangleF(new PointF(labelX, _sliderR.Frame.Y), labelSize));

            labelR.Text      = "R";
            labelR.TextColor = UIColor.White;
            this.View.AddSubview(labelR);

            var labelG = new UILabel(new RectangleF(new PointF(labelX, _sliderG.Frame.Y), labelSize));

            labelG.Text      = "G";
            labelG.TextColor = UIColor.White;
            this.View.AddSubview(labelG);

            var labelB = new UILabel(new RectangleF(new PointF(labelX, _sliderB.Frame.Y), labelSize));

            labelB.Text      = "B";
            labelB.TextColor = UIColor.White;
            this.View.AddSubview(labelB);

            var labelValueX    = sliderSize.Width + 65f;
            var labelValueSize = new SizeF(40f, 20f);

            _labelRValue           = new UILabel(new RectangleF(new PointF(labelValueX, _sliderR.Frame.Y), labelValueSize));
            _labelRValue.Text      = "255";
            _labelRValue.TextColor = UIColor.White;
            this.View.AddSubview(_labelRValue);

            _labelGValue           = new UILabel(new RectangleF(new PointF(labelValueX, _sliderG.Frame.Y), labelValueSize));
            _labelGValue.Text      = "0";
            _labelGValue.TextColor = UIColor.White;
            this.View.AddSubview(_labelGValue);

            _labelBValue           = new UILabel(new RectangleF(new PointF(labelValueX, _sliderB.Frame.Y), labelValueSize));
            _labelBValue.Text      = "0";
            _labelBValue.TextColor = UIColor.White;
            this.View.AddSubview(_labelBValue);
        }
コード例 #49
0
    /// <summary>
    /// Progress bar creation function.
    /// </summary>

    void CreateSlider(GameObject go, bool slider)
    {
        if (NGUISettings.atlas != null)
        {
            NGUIEditorTools.SpriteField("Empty", "Sprite for the background (empty bar)", NGUISettings.atlas, mSliderBG, OnSliderBG);
            NGUIEditorTools.SpriteField("Full", "Sprite for the foreground (full bar)", NGUISettings.atlas, mSliderFG, OnSliderFG);

            if (slider)
            {
                NGUIEditorTools.SpriteField("Thumb", "Sprite for the thumb indicator", NGUISettings.atlas, mSliderTB, OnSliderTB);
            }
        }

        if (ShouldCreate(go, NGUISettings.atlas != null))
        {
            int depth = NGUITools.CalculateNextDepth(go);
            go      = NGUITools.AddChild(go);
            go.name = slider ? "Slider" : "Progress Bar";

            // Background sprite
            UIAtlas.Sprite bgs  = NGUISettings.atlas.GetSprite(mSliderBG);
            UISprite       back = (UISprite)NGUITools.AddWidget <UISprite>(go);

            back.type                    = (bgs.inner == bgs.outer) ? UISprite.Type.Simple : UISprite.Type.Sliced;
            back.name                    = "Background";
            back.depth                   = depth;
            back.pivot                   = UIWidget.Pivot.Left;
            back.atlas                   = NGUISettings.atlas;
            back.spriteName              = mSliderBG;
            back.transform.localScale    = new Vector3(200f, 30f, 1f);
            back.transform.localPosition = Vector3.zero;
            back.MakePixelPerfect();

            // Foreground sprite
            UIAtlas.Sprite fgs   = NGUISettings.atlas.GetSprite(mSliderFG);
            UISprite       front = NGUITools.AddWidget <UISprite>(go);
            front.type                    = (fgs.inner == fgs.outer) ? UISprite.Type.Filled : UISprite.Type.Sliced;
            front.name                    = "Foreground";
            front.pivot                   = UIWidget.Pivot.Left;
            front.atlas                   = NGUISettings.atlas;
            front.spriteName              = mSliderFG;
            front.transform.localScale    = new Vector3(200f, 30f, 1f);
            front.transform.localPosition = Vector3.zero;
            front.MakePixelPerfect();

            // Add a collider
            if (slider)
            {
                NGUITools.AddWidgetCollider(go);
            }

            // Add the slider script
            UISlider uiSlider = go.AddComponent <UISlider>();
            uiSlider.foreground = front.transform;

            // Thumb sprite
            if (slider)
            {
                UIAtlas.Sprite tbs = NGUISettings.atlas.GetSprite(mSliderTB);
                UISprite       thb = NGUITools.AddWidget <UISprite>(go);

                thb.type       = (tbs.inner == tbs.outer) ? UISprite.Type.Simple : UISprite.Type.Sliced;
                thb.name       = "Thumb";
                thb.atlas      = NGUISettings.atlas;
                thb.spriteName = mSliderTB;
                thb.transform.localPosition = new Vector3(200f, 0f, 0f);
                thb.transform.localScale    = new Vector3(20f, 40f, 1f);
                thb.MakePixelPerfect();

                NGUITools.AddWidgetCollider(thb.gameObject);
                thb.gameObject.AddComponent <UIButtonColor>();
                thb.gameObject.AddComponent <UIButtonScale>();

                uiSlider.thumb = thb.transform;
            }
            uiSlider.sliderValue = 1f;

            // Select the slider
            Selection.activeGameObject = go;
        }
    }
コード例 #50
0
ファイル: UIOptions.cs プロジェクト: HarryFreeMyLand/newso
        public UIProfanityOptions()
        {
            //var alert = UIScreen.GlobalShowAlert(new UIAlertOptions { Title = "Not Implemented", Message = "This feature is not implemented yet!" }, true);
            var uis = RenderScript("profanitypanel.uis");

            //don't draw, this currently breaks the uis parser
            //var bg = uis.Create<UIImage>("Background");
            //AddAt(0, bg);
            Remove(PrevColorButton);
            Remove(NextColorButton);
            Remove(AddButton);
            Remove(SubtractButton);
            Remove(EnableFilterCheckButton);
            Remove(ProfanityFilterTitle);
            Remove(EntryBox);

            EnterWordLabel.Caption = GameFacade.Strings.GetString("f113", "5");

            var ttsToggleContainer = new UIHBoxContainer();

            ttsToggleContainer.Add(new UILabel()
            {
                Caption = GameFacade.Strings.GetString("f113", "1")
            });
            var ttsMode = GlobalSettings.Default.TTSMode;

            for (int i = 0; i < 3; i++)
            {
                var radio = new UIRadioButton
                {
                    RadioData  = i,
                    RadioGroup = "ttsOpt"
                };
                radio.OnButtonClick += TTSOptSet;
                radio.Tooltip        = GameFacade.Strings.GetString("f113", (2 + i).ToString());
                radio.Selected       = ttsMode == i;
                ttsToggleContainer.Add(radio);
                ttsToggleContainer.Add(new UILabel()
                {
                    Caption = radio.Tooltip
                });
            }

            ttsToggleContainer.Position = new Vector2(10, 10);
            Add(ttsToggleContainer);
            ttsToggleContainer.AutoSize();

            var col = new Color(GlobalSettings.Default.ChatColor);

            ChatColor.CaptionStyle        = ChatColor.CaptionStyle.Clone();
            ChatColor.CaptionStyle.Color  = col;
            ChatColor.CaptionStyle.Shadow = true;
            ChatColor.Caption             = "#" + col.R.ToString("x2") + col.G.ToString("x2") + col.B.ToString("x2");

            var changeBtn = new UIButton
            {
                Caption  = GameFacade.Strings.GetString("f113", "6"),
                Position = new Vector2(155 + 100, 74 - 7)
            };

            Add(changeBtn);
            changeBtn.OnButtonClick += (btn1) =>
            {
                UIAlert alert = null;
                alert = UIScreen.GlobalShowAlert(new UIAlertOptions()
                {
                    Title   = "",
                    Message = GameFacade.Strings.GetString("f113", "8"),
                    Color   = true,
                    Buttons = new UIAlertButton[]
                    {
                        new UIAlertButton(UIAlertButtonType.OK, (btn) => {
                            //set the color
                            var col2 = int.Parse(alert.ResponseText);
                            GlobalSettings.Default.ChatColor = new Color(col2 >> 16, (byte)(col2 >> 8), (byte)col2).PackedValue;
                            SetChatParams();
                            UIScreen.RemoveDialog(alert);
                        }),
                        new UIAlertButton(UIAlertButtonType.No, (btn) => {
                            //set the color
                            var rand = new Random();
                            GlobalSettings.Default.ChatColor = VMTSOAvatarState.RandomColours[rand.Next(VMTSOAvatarState.RandomColours.Length)].PackedValue;
                            SetChatParams();
                            UIScreen.RemoveDialog(alert);
                        }, GameFacade.Strings.GetString("f113", "7")),
                        new UIAlertButton(UIAlertButtonType.Cancel)
                    }
                }, true);
            };
            var chatTimestampContainer = new UIHBoxContainer();

            chatTimestampContainer.Add(new UILabel()
            {
                Caption = GameFacade.Strings.GetString("f113", "44")
            });
            var chatShowTimestamp = GlobalSettings.Default.ChatShowTimestamp;
            var radioChatTSOff    = new UIRadioButton
            {
                RadioData  = false,
                RadioGroup = "chatTSToggle"
            };

            radioChatTSOff.OnButtonClick += ChatTsOptSet;
            radioChatTSOff.Tooltip        = GameFacade.Strings.GetString("f113", "45");
            radioChatTSOff.Selected       = chatShowTimestamp == false;
            chatTimestampContainer.Add(radioChatTSOff);
            chatTimestampContainer.Add(new UILabel()
            {
                Caption = radioChatTSOff.Tooltip
            });

            var radioChatTSOn = new UIRadioButton
            {
                RadioData  = true,
                RadioGroup = "chatTSToggle"
            };

            radioChatTSOn.OnButtonClick += ChatTsOptSet;
            radioChatTSOn.Tooltip        = GameFacade.Strings.GetString("f113", "46");
            radioChatTSOn.Selected       = chatShowTimestamp == true;
            chatTimestampContainer.Add(radioChatTSOn);
            chatTimestampContainer.Add(new UILabel()
            {
                Caption = radioChatTSOn.Tooltip
            });

            chatTimestampContainer.Position = new Vector2(368, 10);
            Add(chatTimestampContainer);
            chatTimestampContainer.AutoSize();

            var chatOpacityContainer = new UIHBoxContainer
            {
                Position = new Vector2(368, 32)
            };
            var chatOpacityLabel = new UILabel()
            {
                Caption = GameFacade.Strings.GetString("f113", "47")
            };

            chatOpacityContainer.Add(chatOpacityLabel);
            var chatOpacity       = GlobalSettings.Default.ChatWindowsOpacity;
            var chatOpacitySlider = new UISlider
            {
                Orientation   = 0,
                Texture       = GetTexture(0x42500000001),
                MinValue      = 20,
                MaxValue      = 100,
                AllowDecimals = false,
                Position      = chatOpacityLabel.Position + new Vector2(115, 24),
                Value         = GlobalSettings.Default.ChatWindowsOpacity * 100
            };

            chatOpacitySlider.SetSize(140f, 0f);
            chatOpacityContainer.Add(chatOpacitySlider);
            Add(chatOpacityContainer);
            chatOpacityContainer.AutoSize();

            PitchSlider = new UISlider
            {
                Orientation   = 0,
                Texture       = GetTexture(0x42500000001),
                MinValue      = -100f,
                MaxValue      = 100f,
                AllowDecimals = false,
                Position      = EnterWordLabel.Position + new Vector2(115, 3),
                Value         = GlobalSettings.Default.ChatTTSPitch
            };
            PitchSlider.SetSize(150f, 0f);
            Add(PitchSlider);

            chatOpacitySlider.OnChange += chatOpacitySlider_OnChange;
            PitchSlider.OnChange       += PitchSlider_OnChange;
        }
コード例 #51
0
        protected void CreateSoundSlider(UIHelperBase helper, ISound sound)
        {
            // Initialize variables
            var configuration    = Mod.Instance.Settings.GetSoundsByCategoryId <string>(sound.CategoryId);
            var customAudioFiles = SoundPacksManager.instance.AudioFiles.Where(kvp => kvp.Key.StartsWith(string.Format("{0}.{1}", sound.CategoryId, sound.Id))).ToDictionary(kvp => kvp.Key, kvp => kvp.Value);

            float volume = 0;

            if (configuration.ContainsKey(sound.Id))
            {
                volume = configuration[sound.Id].Volume;
            }
            else
            {
                Mod.Instance.Log.Info("No volume configuration found for {0}.{1}, using default value", sound.CategoryId, sound.Id);
                volume = sound.DefaultVolume;
            }

            // Add UI components
            UISlider   uiSlider   = null;
            UIPanel    uiPanel    = null;
            UILabel    uiLabel    = null;
            UIDropDown uiDropDown = null;
            var        maxVolume  = sound.MaxVolume;

            if (customAudioFiles.Count > 0 && configuration.ContainsKey(sound.Id) && !string.IsNullOrEmpty(configuration[sound.Id].SoundPack))
            {
                // Custom sound, determine custom max volume
                var audioFile = SoundPacksManager.instance.GetAudioFileByName(sound.CategoryId, sound.Id, configuration[sound.Id].SoundPack);
                maxVolume = Mathf.Max(audioFile.AudioInfo.MaxVolume, audioFile.AudioInfo.Volume);
            }

            uiSlider = (UISlider)helper.AddSlider(sound.Name, 0, maxVolume, 0.01f, volume, v => this.SoundVolumeChanged(sound, v));
            uiPanel  = (UIPanel)uiSlider.parent;
            uiLabel  = uiPanel.Find <UILabel>("Label");

            if (customAudioFiles.Count > 0)
            {
                uiDropDown        = uiPanel.AttachUIComponent(GameObject.Instantiate((UITemplateManager.Peek(UITemplateDefs.ID_OPTIONS_DROPDOWN_TEMPLATE) as UIPanel).Find <UIDropDown>("Dropdown").gameObject)) as UIDropDown;
                uiDropDown.items  = new[] { "Default" }.Union(customAudioFiles.Select(kvp => kvp.Value.Name)).ToArray();
                uiDropDown.height = 28;
                uiDropDown.textFieldPadding.top = 4;
                if (configuration.ContainsKey(sound.Id) && !string.IsNullOrEmpty(configuration[sound.Id].SoundPack))
                {
                    uiDropDown.selectedValue = configuration[sound.Id].SoundPack;
                }
                else
                {
                    uiDropDown.selectedIndex = 0;
                }

                uiDropDown.eventSelectedIndexChanged += (c, i) => this.SoundPackChanged(sound, i > 0 ? ((UIDropDown)c).items[i] : null, uiSlider);
                this.soundSelections[string.Format("{0}.{1}", sound.CategoryId, sound.Id)] = uiDropDown;
            }

            // Configure UI components
            uiPanel.autoLayout            = false;
            uiLabel.anchor                = UIAnchorStyle.Left | UIAnchorStyle.CenterVertical;
            uiLabel.width                 = 250;
            uiSlider.anchor               = UIAnchorStyle.CenterVertical;
            uiSlider.builtinKeyNavigation = false;
            uiSlider.width                = 207;
            uiSlider.relativePosition     = new Vector3(uiLabel.relativePosition.x + uiLabel.width + 20, 0);
            if (customAudioFiles.Count > 0)
            {
                uiDropDown.anchor           = UIAnchorStyle.CenterVertical;
                uiDropDown.width            = 180;
                uiDropDown.relativePosition = new Vector3(uiSlider.relativePosition.x + uiSlider.width + 20, 0);
                uiPanel.size = new Vector2(uiDropDown.relativePosition.x + uiDropDown.width, 32);
            }
            else
            {
                uiPanel.size = new Vector2(uiSlider.relativePosition.x + uiSlider.width, 32);
            }
        }
コード例 #52
0
        public override void LoadView()
        {
            // Create and add the container views.
            View = new UIView()
            {
                BackgroundColor = UIColor.White
            };

            UIScrollView scrollView = new UIScrollView();

            scrollView.TranslatesAutoresizingMaskIntoConstraints = false;

            View.AddSubviews(scrollView);

            scrollView.TopAnchor.ConstraintEqualTo(View.TopAnchor).Active           = true;
            scrollView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor).Active   = true;
            scrollView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor).Active = true;
            scrollView.BottomAnchor.ConstraintEqualTo(View.BottomAnchor).Active     = true;

            UIStackView formContainer = new UIStackView();

            formContainer.TranslatesAutoresizingMaskIntoConstraints = false;
            formContainer.Spacing = 8;
            formContainer.LayoutMarginsRelativeArrangement = true;
            formContainer.Alignment     = UIStackViewAlignment.Fill;
            formContainer.LayoutMargins = new UIEdgeInsets(8, 8, 8, 8);
            formContainer.Axis          = UILayoutConstraintAxis.Vertical;
            formContainer.WidthAnchor.ConstraintEqualTo(300).Active = true;

            // Create and add each row.
            UILabel analysisLabel = new UILabel();

            analysisLabel.TranslatesAutoresizingMaskIntoConstraints = false;
            analysisLabel.Text           = "Analysis overlay";
            _analysisVisibilitySwitch    = new UISwitch();
            _analysisVisibilitySwitch.On = _viewshed.IsVisible;
            _analysisVisibilitySwitch.TranslatesAutoresizingMaskIntoConstraints = false;
            formContainer.AddArrangedSubview(getRowStackView(new UIView[] { analysisLabel, _analysisVisibilitySwitch }));

            UILabel frustumLabel = new UILabel();

            frustumLabel.TranslatesAutoresizingMaskIntoConstraints = false;
            frustumLabel.Text           = "Frustum";
            _frustumVisibilitySwitch    = new UISwitch();
            _frustumVisibilitySwitch.On = _viewshed.IsFrustumOutlineVisible;
            _frustumVisibilitySwitch.TranslatesAutoresizingMaskIntoConstraints = false;
            formContainer.AddArrangedSubview(getRowStackView(new UIView[] { frustumLabel, _frustumVisibilitySwitch }));

            UILabel headingLabel = new UILabel();

            headingLabel.TranslatesAutoresizingMaskIntoConstraints = false;
            headingLabel.Text = "Heading";
            _headingSlider    = new UISlider {
                MinValue = 0, MaxValue = 360, Value = (float)_viewshed.Heading
            };
            _headingSlider.TranslatesAutoresizingMaskIntoConstraints = false;
            formContainer.AddArrangedSubview(getRowStackView(new UIView[] { headingLabel, _headingSlider }));

            UILabel pitchLabel = new UILabel();

            pitchLabel.TranslatesAutoresizingMaskIntoConstraints = false;
            pitchLabel.Text = "Pitch";
            _pitchSlider    = new UISlider {
                MinValue = 0, MaxValue = 180, Value = (float)_viewshed.Pitch
            };
            _pitchSlider.TranslatesAutoresizingMaskIntoConstraints = false;
            formContainer.AddArrangedSubview(getRowStackView(new UIView[] { pitchLabel, _pitchSlider }));

            UILabel horizontalLabel = new UILabel();

            horizontalLabel.TranslatesAutoresizingMaskIntoConstraints = false;
            horizontalLabel.Text   = "Horizontal";
            _horizontalAngleSlider = new UISlider {
                MinValue = 1, MaxValue = 120, Value = (float)_viewshed.HorizontalAngle
            };
            _horizontalAngleSlider.TranslatesAutoresizingMaskIntoConstraints = false;
            formContainer.AddArrangedSubview(getRowStackView(new UIView[] { horizontalLabel, _horizontalAngleSlider }));

            UILabel verticalLabel = new UILabel();

            verticalLabel.TranslatesAutoresizingMaskIntoConstraints = false;
            verticalLabel.Text   = "Vertical";
            _verticalAngleSlider = new UISlider {
                MinValue = 1, MaxValue = 120, Value = (float)_viewshed.VerticalAngle
            };
            _verticalAngleSlider.TranslatesAutoresizingMaskIntoConstraints = false;
            formContainer.AddArrangedSubview(getRowStackView(new UIView[] { verticalLabel, _verticalAngleSlider }));

            UILabel minLabel = new UILabel();

            minLabel.TranslatesAutoresizingMaskIntoConstraints = false;
            minLabel.Text          = "Min";
            _minimumDistanceSlider = new UISlider {
                MinValue = 11, MaxValue = 8999, Value = (float)_viewshed.MinDistance
            };
            _minimumDistanceSlider.TranslatesAutoresizingMaskIntoConstraints = false;
            formContainer.AddArrangedSubview(getRowStackView(new UIView[] { minLabel, _minimumDistanceSlider }));

            UILabel maxLabel = new UILabel();

            maxLabel.TranslatesAutoresizingMaskIntoConstraints = false;
            maxLabel.Text          = "Max";
            _maximumDistanceSlider = new UISlider {
                MinValue = 0, MaxValue = 9999, Value = (float)_viewshed.MaxDistance
            };
            _maximumDistanceSlider.TranslatesAutoresizingMaskIntoConstraints = false;
            formContainer.AddArrangedSubview(getRowStackView(new UIView[] { maxLabel, _maximumDistanceSlider }));

            // Lay out container and scroll view.
            scrollView.AddSubview(formContainer);

            formContainer.TopAnchor.ConstraintEqualTo(scrollView.TopAnchor).Active           = true;
            formContainer.LeadingAnchor.ConstraintEqualTo(scrollView.LeadingAnchor).Active   = true;
            formContainer.TrailingAnchor.ConstraintEqualTo(scrollView.TrailingAnchor).Active = true;
            formContainer.BottomAnchor.ConstraintEqualTo(scrollView.BottomAnchor).Active     = true;
        }
コード例 #53
0
        public override void LoadView()
        {
            // Create the views.
            View = new UIView {
                BackgroundColor = UIColor.White
            };

            UIToolbar topToolbar = new UIToolbar();

            topToolbar.TranslatesAutoresizingMaskIntoConstraints = false;

            _myMapView = new MapView();
            _myMapView.TranslatesAutoresizingMaskIntoConstraints = false;

            _timeLabel = new UILabel
            {
                TextColor     = UIColor.Black,
                TextAlignment = UITextAlignment.Center,
                TranslatesAutoresizingMaskIntoConstraints = false
            };

            _timeSlider = new UISlider
            {
                MinValue = 0,
                MaxValue = 1,
                TranslatesAutoresizingMaskIntoConstraints = false
            };

            UIToolbar bottomToolbar = new UIToolbar();

            bottomToolbar.TranslatesAutoresizingMaskIntoConstraints = false;
            bottomToolbar.Items = new[]
            {
                new UIBarButtonItem(_timeLabel),
                new UIBarButtonItem(UIBarButtonSystemItem.FixedSpace)
                {
                    Width = 0
                },
                new UIBarButtonItem(_timeSlider)
            };

            UIStackView legendView = new UIStackView();

            legendView.TranslatesAutoresizingMaskIntoConstraints = false;
            legendView.Axis    = UILayoutConstraintAxis.Horizontal;
            legendView.Spacing = 8;

            UIView redIcon = new UIView();

            redIcon.TranslatesAutoresizingMaskIntoConstraints = false;
            redIcon.BackgroundColor = UIColor.Red;
            redIcon.WidthAnchor.ConstraintEqualTo(16).Active  = true;
            redIcon.HeightAnchor.ConstraintEqualTo(16).Active = true;
            redIcon.ClipsToBounds      = true;
            redIcon.Layer.CornerRadius = 8;
            legendView.AddArrangedSubview(redIcon);

            UILabel _redLabel = new UILabel
            {
                Text      = "Offset 10 days",
                TextColor = UIColor.Red,
                TranslatesAutoresizingMaskIntoConstraints = false
            };

            legendView.AddArrangedSubview(_redLabel);

            UIView spacer = new UIView();

            spacer.TranslatesAutoresizingMaskIntoConstraints = false;
            spacer.SetContentCompressionResistancePriority((float)UILayoutPriority.DefaultLow, UILayoutConstraintAxis.Horizontal);
            legendView.AddArrangedSubview(spacer);

            UIView blueIcon = new UIView();

            blueIcon.BackgroundColor = UIColor.Blue;
            blueIcon.TranslatesAutoresizingMaskIntoConstraints = false;
            blueIcon.WidthAnchor.ConstraintEqualTo(16).Active  = true;
            blueIcon.HeightAnchor.ConstraintEqualTo(16).Active = true;
            blueIcon.ClipsToBounds      = true;
            blueIcon.Layer.CornerRadius = 8;
            legendView.AddArrangedSubview(blueIcon);

            UILabel _blueLabel = new UILabel
            {
                Text      = "No offset",
                TextColor = UIColor.Blue,
                TranslatesAutoresizingMaskIntoConstraints = false
            };

            legendView.AddArrangedSubview(_blueLabel);

            // Add the views.
            View.AddSubviews(topToolbar, _myMapView, bottomToolbar);
            topToolbar.AddSubview(legendView);

            // Lay out the views.
            NSLayoutConstraint.ActivateConstraints(new[]
            {
                topToolbar.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor),
                topToolbar.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor),
                topToolbar.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor),

                _myMapView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor),
                _myMapView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor),
                _myMapView.TopAnchor.ConstraintEqualTo(topToolbar.BottomAnchor),
                _myMapView.BottomAnchor.ConstraintEqualTo(bottomToolbar.TopAnchor),

                bottomToolbar.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor),
                bottomToolbar.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor),
                bottomToolbar.BottomAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.BottomAnchor),

                legendView.LeftAnchor.ConstraintEqualTo(topToolbar.SafeAreaLayoutGuide.LeftAnchor, 8),
                legendView.RightAnchor.ConstraintEqualTo(topToolbar.SafeAreaLayoutGuide.RightAnchor, -8),
                legendView.TopAnchor.ConstraintEqualTo(topToolbar.SafeAreaLayoutGuide.TopAnchor, 8),
                legendView.BottomAnchor.ConstraintEqualTo(topToolbar.SafeAreaLayoutGuide.BottomAnchor, -8),

                redIcon.CenterYAnchor.ConstraintEqualTo(blueIcon.CenterYAnchor),
                blueIcon.CenterYAnchor.ConstraintEqualTo(topToolbar.CenterYAnchor),

                _timeLabel.WidthAnchor.ConstraintEqualTo(150),
                _timeSlider.WidthAnchor.ConstraintEqualTo(600),
            });
        }
コード例 #54
0
        private void KeepMe()
        {
            // UIButon
            var btn   = new UIButton();
            var title = btn.Title(UIControlState.Disabled);

            btn.SetTitle("foo", UIControlState.Disabled);
            btn.TitleLabel.Text = btn.TitleLabel.Text;



            // UISlider
            var slider = new UISlider();

            slider.Value = slider.Value; // Get and set


            // UITextView
            var tv = new UITextView();

            tv.Text = tv.Text;

            // UITextField
            var tf = new UITextField();

            tv.Text = tf.Text;

            // var UIImageView
            var iv = new UIImageView();

            iv.Image = iv.Image;

            // UI Label
            var lbl = new UILabel();

            lbl.Text = lbl.Text;

            // UI Control
            var ctl = new UIControl();

            ctl.Enabled  = ctl.Enabled;
            ctl.Selected = ctl.Selected;

            EventHandler eh = (s, e) => { };

            ctl.TouchUpInside += eh;
            ctl.TouchUpInside -= eh;

            // UIRefreshControl
            var rc = new UIRefreshControl();

            rc.ValueChanged += eh;
            rc.ValueChanged -= eh;

            // UIBarButtonItem
            var bbi = new UIBarButtonItem();

            bbi.Clicked += eh;
            bbi.Clicked -= eh;

            eh.Invoke(null, null);
        }
        public override void LoadView()
        {
            // Create and configure views.
            _mySceneView = new SceneView();
            _mySceneView.TranslatesAutoresizingMaskIntoConstraints = false;

            _headingSlider = new UISlider();
            _headingSlider.TranslatesAutoresizingMaskIntoConstraints = false;
            _headingSlider.MinValue = 0;
            _headingSlider.MaxValue = 360;

            _pitchSlider = new UISlider();
            _pitchSlider.TranslatesAutoresizingMaskIntoConstraints = false;
            _pitchSlider.MinValue = -90;
            _pitchSlider.MaxValue = 90;

            UILabel headingLabel = new UILabel();

            headingLabel.TranslatesAutoresizingMaskIntoConstraints = false;
            headingLabel.Text = "Heading: ";

            UILabel pitchLabel = new UILabel();

            pitchLabel.TranslatesAutoresizingMaskIntoConstraints = false;
            pitchLabel.Text = "Pitch:";

            _pitchValueLabel = new UILabel();
            _pitchValueLabel.TranslatesAutoresizingMaskIntoConstraints = false;
            _pitchValueLabel.TextAlignment = UITextAlignment.Center;

            _headingValueLabel = new UILabel();
            _headingValueLabel.TranslatesAutoresizingMaskIntoConstraints = false;
            _headingValueLabel.TextAlignment = UITextAlignment.Center;

            View = new UIView {
                BackgroundColor = UIColor.White
            };

            // Add the views.
            View.AddSubviews(_mySceneView, _headingSlider, _pitchSlider, headingLabel, _headingValueLabel, pitchLabel, _pitchValueLabel);

            // Configure constraints.
            _mySceneView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor).Active = true;
            _mySceneView.BottomAnchor.ConstraintEqualTo(headingLabel.TopAnchor).Active          = true;
            _mySceneView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor).Active             = true;
            _mySceneView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor).Active           = true;

            pitchLabel.BottomAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.BottomAnchor, -8).Active  = true;
            pitchLabel.LeadingAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.LeadingAnchor, 8).Active = true;
            pitchLabel.HeightAnchor.ConstraintEqualTo(36).Active = true;

            headingLabel.BottomAnchor.ConstraintEqualTo(pitchLabel.TopAnchor).Active        = true;
            headingLabel.LeadingAnchor.ConstraintEqualTo(pitchLabel.LeadingAnchor).Active   = true;
            headingLabel.TrailingAnchor.ConstraintEqualTo(pitchLabel.TrailingAnchor).Active = true;
            headingLabel.HeightAnchor.ConstraintEqualTo(36).Active = true;

            _headingSlider.BottomAnchor.ConstraintEqualTo(headingLabel.BottomAnchor).Active = true;
            _headingSlider.TrailingAnchor.ConstraintEqualTo(_headingValueLabel.LeadingAnchor, -8).Active = true;
            _headingSlider.LeadingAnchor.ConstraintEqualTo(headingLabel.TrailingAnchor).Active           = true;

            _pitchSlider.LeadingAnchor.ConstraintEqualTo(pitchLabel.TrailingAnchor).Active           = true;
            _pitchSlider.TrailingAnchor.ConstraintEqualTo(_pitchValueLabel.LeadingAnchor, -8).Active = true;
            _pitchSlider.BottomAnchor.ConstraintEqualTo(pitchLabel.BottomAnchor).Active = true;

            _pitchValueLabel.TrailingAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TrailingAnchor).Active = true;
            _pitchValueLabel.WidthAnchor.ConstraintEqualTo(50).Active = true;
            _pitchValueLabel.BottomAnchor.ConstraintEqualTo(pitchLabel.BottomAnchor).Active = true;

            _headingValueLabel.TrailingAnchor.ConstraintEqualTo(_pitchValueLabel.TrailingAnchor).Active = true;
            _headingValueLabel.LeadingAnchor.ConstraintEqualTo(_pitchValueLabel.LeadingAnchor).Active   = true;
            _headingValueLabel.BottomAnchor.ConstraintEqualTo(headingLabel.BottomAnchor).Active         = true;
        }
コード例 #56
0
        private void InitUIAssets()
        {
            // add the cash out button (and background) and machine balance information, ubiquitious to all objects
            CashOutButtonSeat = new UIImage(ButtonSeatTexture)
            {
                X = 60,
                Y = 90
            };
            AddAt(0, CashOutButtonSeat);
            CashOutButton = new UIButton(CashOutTexture)
            {
                X       = 63,
                Y       = 93,
                Tooltip = GameFacade.Strings["UIText", "259", "10"] // "Click to cash out"
            };
            Add(CashOutButton);
            CashOutButton.OnButtonClick += OnCashoutButtonClick;

            MachineBalanceTextBack = new UIImage(TextBackTexture)
            {
                X = 100,
                Y = 90
            };
            AddAt(0, MachineBalanceTextBack);
            MachineBalanceText = new UITextEdit()
            {
                Size        = new Vector2(85, 20),
                X           = 104,
                Y           = 94,
                Alignment   = TextAlignment.Center,
                Mode        = UITextEditMode.ReadOnly,
                CurrentText = "$" + ObjectBalance,
                Tooltip     = GameFacade.Strings.GetString("f110", "35") // "Cash in object"
            };
            var textStyle = MachineBalanceText.TextStyle.Clone();

            textStyle.Size = 12;
            MachineBalanceText.TextStyle = textStyle;
            Add(MachineBalanceText);

            // add more assets depending on machine type
            switch (Type)
            {
            case ManageEODObjectTypes.SlotMachine:
            {
                // add the on/off button, and the odds slider
                OnOffButton = new UIButton(GetTexture(0x0000049C00000001))
                {
                    Tooltip = GameFacade.Strings["UIText", "259", "12"],         // "Current Odds"
                    X       = 175,
                    Y       = 60
                };
                Add(OnOffButton);
                OnOffButton.OnButtonClick += OnOffButtonClick;

                // initiate OnOffButton
                if (ObjectIsOn)
                {
                    OnOffButton.Tooltip    = GameFacade.Strings["UIText", "259", "14"];      // "Turn Off"
                    OnOffButton.ForceState = 1;
                }
                else
                {
                    OnOffButton.Tooltip    = GameFacade.Strings["UIText", "259", "13"];      // "Turn On"
                    OnOffButton.ForceState = 0;
                }

                // the slider for the odds
                OddsSlider = new UISlider()
                {
                    Texture     = GetTexture(0x00000CA400000001),
                    Tooltip     = ObjectOdds + "%",
                    Size        = new Vector2(100, 1),
                    MinValue    = 80,
                    MaxValue    = 110,
                    Orientation = 0,
                    X           = 286,
                    Y           = 104
                };
                Add(OddsSlider);
                OddsSlider.Value     = ObjectOdds;
                OddsSlider.OnChange += OddsChangeHandler;

                // add slot machine labels
                OnOff = new UILabel()
                {
                    Size         = new Vector2(100, 21),
                    X            = 70,
                    Y            = 55,
                    _Alignment   = 1,
                    Caption      = GameFacade.Strings["UIText", "259", "20"],    // "Turn On/Off"
                    CaptionStyle = textStyle
                };
                Add(OnOff);

                Odds = new UILabel()
                {
                    Size         = new Vector2(120, 21),
                    X            = 278,
                    Y            = 55,
                    _Alignment   = 1,
                    Caption      = GameFacade.Strings["UIText", "259", "7"],    // "Set the Odds"
                    CaptionStyle = textStyle
                };
                Add(Odds);

                Player = new UILabel()
                {
                    Size         = new Vector2(80, 21),
                    X            = 380,
                    Y            = 94,
                    _Alignment   = 1,
                    Caption      = GameFacade.Strings["UIText", "259", "9"],    // "Player"
                    CaptionStyle = textStyle
                };
                Add(Player);

                House = new UILabel()
                {
                    Size         = new Vector2(80, 21),
                    X            = 220,
                    Y            = 94,
                    _Alignment   = 1,
                    Caption      = GameFacade.Strings["UIText", "259", "8"],    // "House"
                    CaptionStyle = textStyle
                };
                Add(House);

                // FreeSO exclusive
                CurrentOdds = new UITextEdit()
                {
                    Size        = new Vector2(45, 20),
                    X           = Odds.X + 46,
                    Y           = 79,
                    Mode        = UITextEditMode.ReadOnly,
                    CurrentText = ObjectOdds + "%"
                };
                Add(CurrentOdds);

                break;
            }

            default:
            {
                // minor adjustments
                MachineBalanceTextBack.Y -= 6;
                MachineBalanceText.Y     -= 6;
                CashOutButton.Y          -= 6;
                CashOutButtonSeat.Y      -= 6;

                // label for machine balance
                MachineBalanceLabel = new UILabel()
                {
                    Size         = new Vector2(100, 21),
                    X            = 82,
                    Y            = 57,
                    Caption      = GameFacade.Strings.GetString("f110", "35") + ":",    // "Cash in object:"
                    CaptionStyle = textStyle
                };
                Add(MachineBalanceLabel);

                // text field and back for minimum bet
                MinimumBetTextBack = new UIImage(TextBackTexture)
                {
                    X = 338,
                    Y = 62
                };
                Add(MinimumBetTextBack);
                MinimumBetText = new UITextEdit()
                {
                    Size        = new Vector2(65, 20),
                    X           = MinimumBetTextBack.X + 14,
                    Y           = MinimumBetTextBack.Y + 4,
                    Alignment   = TextAlignment.Center,
                    Mode        = UITextEditMode.ReadOnly,
                    CurrentText = "$" + ObjectMinimumPlayerBet,
                    TextStyle   = textStyle,
                    Tooltip     = GameFacade.Strings.GetString("f110", "13")     // "Min bet"
                };
                Add(MinimumBetText);

                // text field and back for maximum bet
                MaximumBetTextBack = new UIImage(TextBackTexture)
                {
                    X = MinimumBetTextBack.X,
                    Y = MinimumBetTextBack.Y + 33
                };
                Add(MaximumBetTextBack);
                MaximumBetText = new UITextEdit()
                {
                    Size        = new Vector2(65, 20),
                    X           = MaximumBetTextBack.X + 14,
                    Y           = MaximumBetTextBack.Y + 4,
                    Alignment   = TextAlignment.Center,
                    Mode        = UITextEditMode.ReadOnly,
                    CurrentText = "$" + ObjectMaximumPlayerBet,
                    TextStyle   = textStyle,
                    Tooltip     = GameFacade.Strings.GetString("f110", "14")     // "Max bet"
                };
                Add(MaximumBetText);

                // button and back for minimum bet
                EditMinimumBetButtonSeat = new UIImage(ButtonSeatTexture)
                {
                    X = MinimumBetTextBack.X - 32,
                    Y = MinimumBetTextBack.Y,
                };

                Add(EditMinimumBetButtonSeat);
                EditMinimumBetButton = new UIButton(EditAmountTexture)
                {
                    X       = EditMinimumBetButtonSeat.X + 3,
                    Y       = EditMinimumBetButtonSeat.Y + 3,
                    Tooltip = GameFacade.Strings.GetString("f110", "15") + GameFacade.Strings.GetString("f110", "13"),         // "Edit Min bet"
                };
                EditMinimumBetButtonSeat.ScaleX = EditMinimumBetButtonSeat.ScaleY = (EditMinimumBetButton.Size / CashOutButton.Size).X;
                Add(EditMinimumBetButton);

                // button and back for maximum bet
                EditMaximumBetButtonSeat = new UIImage(ButtonSeatTexture)
                {
                    X = MaximumBetTextBack.X - 32,
                    Y = MaximumBetTextBack.Y
                };
                Add(EditMaximumBetButtonSeat);
                EditMaximumBetButton = new UIButton(EditAmountTexture)
                {
                    X       = EditMaximumBetButtonSeat.X + 3,
                    Y       = EditMaximumBetButtonSeat.Y + 3,
                    Tooltip = GameFacade.Strings.GetString("f110", "15") + GameFacade.Strings.GetString("f110", "14"),         // "Edit Max bet"
                };
                EditMaximumBetButtonSeat.ScaleX = EditMaximumBetButtonSeat.ScaleY = (EditMaximumBetButton.Size / CashOutButton.Size).X;
                Add(EditMaximumBetButton);

                // label for minimum bet
                MinimumBetLabel = new UILabel()
                {
                    Size         = new Vector2(60, 21),
                    X            = EditMinimumBetButtonSeat.X - 70,
                    Y            = MinimumBetText.Y,
                    Alignment    = TextAlignment.Right,
                    Caption      = GameFacade.Strings.GetString("f110", "13") + ":",    // "Min bet:"
                    CaptionStyle = textStyle
                };
                Add(MinimumBetLabel);

                // label for maximum bet
                MaximumBetLabel = new UILabel()
                {
                    Size         = new Vector2(60, 21),
                    X            = EditMaximumBetButtonSeat.X - 70,
                    Y            = MaximumBetText.Y,
                    Alignment    = TextAlignment.Right,
                    Caption      = GameFacade.Strings.GetString("f110", "14") + ":",    // "Max bet:"
                    CaptionStyle = textStyle
                };
                Add(MaximumBetLabel);

                // liseners for editing bet buttons
                EditMinimumBetButton.OnButtonClick += OnEditMinimumClick;
                EditMaximumBetButton.OnButtonClick += OnEditMaximumClick;

                // tweak for Hold'em Casino
                if (Type.Equals(ManageEODObjectTypes.HoldEmCasino))
                {
                    var offset = new Vector2(6, -18);
                    MinimumBetTextBack.Position       += offset;
                    MinimumBetText.Position           += offset;
                    MinimumBetLabel.Position          += offset;
                    EditMinimumBetButtonSeat.Position += offset;
                    EditMinimumBetButton.Position     += offset;

                    MaximumBetTextBack.Position       += offset;
                    MaximumBetText.Position           += offset;
                    MaximumBetLabel.Position          += offset;
                    EditMaximumBetButtonSeat.Position += offset;
                    EditMaximumBetButton.Position     += offset;

                    MachineBalanceTextBack.X -= 20;
                    MachineBalanceText.X     -= 20;
                    CashOutButton.X          -= 20;
                    CashOutButtonSeat.X      -= 20;
                    MachineBalanceLabel.X    -= 20;

                    MinimumBetLabel.Caption      = GameFacade.Strings.GetString("f110", "36") + ":"; // "Min Ante Bet"
                    MaximumBetLabel.Caption      = GameFacade.Strings.GetString("f110", "37") + ":"; // "Max Ante Bet"
                    EditMinimumBetButton.Tooltip = GameFacade.Strings.GetString("f110", "15") +
                                                   GameFacade.Strings.GetString("f110", "36") + ":"; // "Edit Min Ante Bet"
                    EditMaximumBetButton.Tooltip = GameFacade.Strings.GetString("f110", "15") +
                                                   GameFacade.Strings.GetString("f110", "37") + ":"; // "Edit Min Ante Bet"

                    /* Add Max Side Bet stuff */
                    // label for maximum side bet
                    MaximumSideBetTextBack = new UIImage(TextBackTexture)
                    {
                        X = MaximumBetTextBack.X,
                        Y = MaximumBetTextBack.Y + 33
                    };
                    Add(MaximumSideBetTextBack);
                    MaximumSideBetText = new UITextEdit()
                    {
                        Size        = new Vector2(65, 20),
                        X           = MaximumSideBetTextBack.X + 14,
                        Y           = MaximumSideBetTextBack.Y + 4,
                        Alignment   = TextAlignment.Center,
                        Mode        = UITextEditMode.ReadOnly,
                        CurrentText = "$" + ObjectMaximumPlayerSideBet,
                        TextStyle   = textStyle,
                        Tooltip     = GameFacade.Strings.GetString("f110", "38")     // "Max Side Bet"
                    };
                    Add(MaximumSideBetText);
                    EditMaximumSideBetButtonSeat = new UIImage(ButtonSeatTexture)
                    {
                        X = MaximumSideBetTextBack.X - 32,
                        Y = MaximumSideBetTextBack.Y,
                    };
                    Add(EditMaximumSideBetButtonSeat);
                    EditMaximumSideBetButton = new UIButton(EditAmountTexture)
                    {
                        X       = EditMaximumSideBetButtonSeat.X + 3,
                        Y       = EditMaximumSideBetButtonSeat.Y + 3,
                        Tooltip = GameFacade.Strings.GetString("f110", "15") + GameFacade.Strings.GetString("f110", "38"),         // "Edit Max Side Bet"
                    };
                    EditMaximumSideBetButtonSeat.ScaleX = EditMaximumSideBetButtonSeat.ScaleY = (EditMaximumSideBetButton.Size / CashOutButton.Size).X;
                    Add(EditMaximumSideBetButton);
                    MaximumSideBetLabel = new UILabel()
                    {
                        Size         = new Vector2(60, 21),
                        X            = EditMaximumSideBetButtonSeat.X - 70,
                        Y            = MaximumSideBetText.Y,
                        Alignment    = TextAlignment.Right,
                        Caption      = GameFacade.Strings.GetString("f110", "38") + ":",    // "Max Side Bet:"
                        CaptionStyle = textStyle
                    };
                    Add(MaximumSideBetLabel);

                    EditMaximumSideBetButton.OnButtonClick += OnEditSideClick;
                }
                break;
            }
            }
            InputAllowed = true;
        }
コード例 #57
0
        private void CreateOptionView()
        {
            UILabel text = new UILabel();

            text.Text          = "Scale1";
            text.TextAlignment = UITextAlignment.Left;
            text.TextColor     = UIColor.Black;
            text.Frame         = new CGRect(10, 10, 320, 20);
            text.Font          = UIFont.FromName("Helvetica", 14f);

            UILabel text1 = new UILabel();

            text1.Text          = "StartAngle";
            text1.TextAlignment = UITextAlignment.Left;
            text1.TextColor     = UIColor.Black;
            text1.Frame         = new CGRect(10, 35, 320, 20);
            text1.Font          = UIFont.FromName("Helvetica", 14f);

            slider               = new UISlider();
            slider.Frame         = new CGRect(5, 60, 320, 20);
            slider.MinValue      = 0f;
            slider.MaxValue      = 360f;
            slider.Value         = 40f;
            slider.ValueChanged += (object sender, EventArgs e) =>
            {
                scale1.StartAngle = slider.Value;
            };

            UILabel text2 = new UILabel();

            text2.Text          = "SweepAngle";
            text2.TextAlignment = UITextAlignment.Left;
            text2.TextColor     = UIColor.Black;
            text2.Frame         = new CGRect(10, 85, 320, 20);
            text2.Font          = UIFont.FromName("Helvetica", 14f);


            UISlider slider1 = new UISlider();

            slider1.Frame         = new CGRect(5, 110, 320, 20);
            slider1.MinValue      = 0f;
            slider1.MaxValue      = 360f;
            slider1.Value         = 320f;
            slider1.ValueChanged += (object sender, EventArgs e) =>
            {
                scale1.SweepAngle = slider1.Value;
            };


            UILabel text3 = new UILabel();

            text3.Text          = "Scale2";
            text3.TextAlignment = UITextAlignment.Left;
            text3.TextColor     = UIColor.Black;
            text3.Frame         = new CGRect(10, 135, 320, 20);
            text3.Font          = UIFont.FromName("Helvetica", 14f);

            UILabel text4 = new UILabel();

            text4.Text          = "StartAngle";
            text4.TextAlignment = UITextAlignment.Left;
            text4.TextColor     = UIColor.Black;
            text4.Frame         = new CGRect(10, 160, 320, 20);
            text4.Font          = UIFont.FromName("Helvetica", 14f);

            UISlider slider2 = new UISlider();

            slider2.Frame         = new CGRect(5, 185, 320, 20);
            slider2.MinValue      = 0f;
            slider2.MaxValue      = 360f;
            slider2.Value         = 40f;
            slider2.ValueChanged += (object sender, EventArgs e) =>
            {
                scale2.StartAngle = slider2.Value;
            };

            UILabel text5 = new UILabel();

            text5.Text          = "SweepAngle";
            text5.TextAlignment = UITextAlignment.Left;
            text5.TextColor     = UIColor.Black;
            text5.Frame         = new CGRect(10, 210, 320, 20);
            text5.Font          = UIFont.FromName("Helvetica", 14f);

            UISlider slider3 = new UISlider();

            slider3.Frame         = new CGRect(5, 235, 320, 20);
            slider3.MinValue      = 0f;
            slider3.MaxValue      = 360f;
            slider3.Value         = 320f;
            slider3.ValueChanged += (object sender, EventArgs e) =>
            {
                scale2.SweepAngle = slider3.Value;
            };

            this.option.AddSubview(text);
            this.option.AddSubview(text1);
            this.option.AddSubview(slider);
            this.option.AddSubview(text2);
            this.option.AddSubview(slider1);
            this.option.AddSubview(text3);
            this.option.AddSubview(text4);
            this.option.AddSubview(slider2);
            this.option.AddSubview(text5);
            this.option.AddSubview(slider3);
        }
コード例 #58
0
 // Use this for initialization
 void Awake()
 {
     player = FindObjectOfType <Player>();
     slider = GetComponent <UISlider>();
 }
コード例 #59
0
        public override void ViewDidLoad()
        {
            View = new UIView()
            {
                BackgroundColor = UIColor.White
            };
            base.ViewDidLoad();

            // ios7 layout
            if (RespondsToSelector(new Selector("edgesForExtendedLayout")))
            {
                EdgesForExtendedLayout = UIRectEdge.None;
            }

            var label = new UILabel(new RectangleF(10, 0, 30, 40));

            label.Text = "SubTotal";
            Add(label);

            var subTotalTextField = new UITextField(new RectangleF(10, 40, 300, 40));

            Add(subTotalTextField);

            var label2 = new UILabel(new RectangleF(10, 0, 30, 40));

            label2.Text = "Gunerosity?";
            Add(label2);

            var slider = new UISlider(new RectangleF(10, 120, 300, 40));

            slider.MinValue = 0;
            slider.MaxValue = 100;
            Add(slider);

            var label3 = new UILabel(new RectangleF(10, 0, 30, 40));

            label3.Text = "Tip";
            Add(label3);

            var tipLabel = new UILabel(new RectangleF(10, 0, 30, 40));

            Add(tipLabel);

            var label4 = new UILabel(new RectangleF(10, 0, 30, 40));

            label4.Text = "Total";
            Add(label4);

            var totalLabel = new UILabel(new RectangleF(10, 0, 30, 40));

            Add(totalLabel);

            var set = this.CreateBindingSet <FirstView, FirstViewModel>();

            set.Bind(subTotalTextField).To(vm => vm.SubTotal);
            set.Bind(slider).To(vm => vm.Generosity);
            set.Bind(tipLabel).To(vm => vm.Tip);
            set.Bind(totalLabel).To(vm => vm.Total);
            set.Apply();

            //タップでキーボードを出す
            var gesture = new UITapGestureRecognizer(() =>
            {
                subTotalTextField.ResignFirstResponder();
            });

            View.AddGestureRecognizer(gesture);
        }
コード例 #60
0
 partial void effectVolumeReleased(UISlider sender)
 {
     this.effectsLevelReleased.Play();
 }