Ejemplo n.º 1
0
	public override void OnInspectorGUI(){
		
		ETCArea t = (ETCArea)target;

		t.show = ETCGuiTools.Toggle("Show at runtime",t.show,true);
		EditorGUILayout.Space();

		preset = (ETCArea.AreaPreset)EditorGUILayout.EnumPopup("Preset",preset );
		if (preset != ETCArea.AreaPreset.Choose){
			t.ApplyPreset( preset);
			preset = ETCArea.AreaPreset.Choose;
		}
	}
Ejemplo n.º 2
0
    public override void OnInspectorGUI()
    {
        ETCArea t = (ETCArea)target;

        t.show = ETCGuiTools.Toggle("Show at runtime", t.show, true);
        EditorGUILayout.Space();

        preset = (ETCArea.AreaPreset)EditorGUILayout.EnumPopup("Preset", preset);
        if (preset != ETCArea.AreaPreset.Choose)
        {
            t.ApplyPreset(preset);
            preset = ETCArea.AreaPreset.Choose;
        }
    }
    // Token: 0x060004A1 RID: 1185 RVA: 0x00015288 File Offset: 0x00013688
    public void ApplyPreset(ETCArea.AreaPreset preset)
    {
        RectTransform component = base.transform.parent.GetComponent <RectTransform>();

        switch (preset)
        {
        case ETCArea.AreaPreset.TopLeft:
            this.rectTransform().anchoredPosition = new Vector2(-component.rect.width / 4f, component.rect.height / 4f);
            this.rectTransform().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, component.rect.width / 2f);
            this.rectTransform().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, component.rect.height / 2f);
            this.rectTransform().anchorMin        = new Vector2(0f, 1f);
            this.rectTransform().anchorMax        = new Vector2(0f, 1f);
            this.rectTransform().anchoredPosition = new Vector2(this.rectTransform().sizeDelta.x / 2f, -this.rectTransform().sizeDelta.y / 2f);
            break;

        case ETCArea.AreaPreset.TopRight:
            this.rectTransform().anchoredPosition = new Vector2(component.rect.width / 4f, component.rect.height / 4f);
            this.rectTransform().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, component.rect.width / 2f);
            this.rectTransform().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, component.rect.height / 2f);
            this.rectTransform().anchorMin        = new Vector2(1f, 1f);
            this.rectTransform().anchorMax        = new Vector2(1f, 1f);
            this.rectTransform().anchoredPosition = new Vector2(-this.rectTransform().sizeDelta.x / 2f, -this.rectTransform().sizeDelta.y / 2f);
            break;

        case ETCArea.AreaPreset.BottomLeft:
            this.rectTransform().anchoredPosition = new Vector2(-component.rect.width / 4f, -component.rect.height / 4f);
            this.rectTransform().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, component.rect.width / 2f);
            this.rectTransform().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, component.rect.height / 2f);
            this.rectTransform().anchorMin        = new Vector2(0f, 0f);
            this.rectTransform().anchorMax        = new Vector2(0f, 0f);
            this.rectTransform().anchoredPosition = new Vector2(this.rectTransform().sizeDelta.x / 2f, this.rectTransform().sizeDelta.y / 2f);
            break;

        case ETCArea.AreaPreset.BottomRight:
            this.rectTransform().anchoredPosition = new Vector2(component.rect.width / 4f, -component.rect.height / 4f);
            this.rectTransform().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, component.rect.width / 2f);
            this.rectTransform().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, component.rect.height / 2f);
            this.rectTransform().anchorMin        = new Vector2(1f, 0f);
            this.rectTransform().anchorMax        = new Vector2(1f, 0f);
            this.rectTransform().anchoredPosition = new Vector2(-this.rectTransform().sizeDelta.x / 2f, this.rectTransform().sizeDelta.y / 2f);
            break;
        }
    }
    public override void OnInspectorGUI()
    {
        ETCArea t = (ETCArea)target;

        t.show = ETCGuiTools.Toggle("Show at runtime",t.show,true);
        EditorGUILayout.Space();

        preset = (ETCArea.AreaPreset)EditorGUILayout.EnumPopup("Preset",preset );
        if (preset != ETCArea.AreaPreset.Choose){
            t.ApplyPreset( preset);
            preset = ETCArea.AreaPreset.Choose;
        }

        if (GUI.changed){
            EditorUtility.SetDirty(t);
            #if UNITY_5_3
            EditorSceneManager.MarkSceneDirty( EditorSceneManager.GetActiveScene());
            #endif
        }
    }
Ejemplo n.º 5
0
    public override void OnInspectorGUI()
    {
        ETCArea t = (ETCArea)target;

        t.show = ETCGuiTools.Toggle("Show at runtime", t.show, true);
        EditorGUILayout.Space();

        preset = (ETCArea.AreaPreset)EditorGUILayout.EnumPopup("Preset", preset);
        if (preset != ETCArea.AreaPreset.Choose)
        {
            t.ApplyPreset(preset);
            preset = ETCArea.AreaPreset.Choose;
        }

        if (GUI.changed)
        {
            EditorUtility.SetDirty(t);
            EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
        }
    }