コード例 #1
0
        public void Set_MaterialTextureSheet(Material mat, SWNodeEffector node)
        {
            var data = node.data;

            if (data.effectData.animationSheetUse)
            {
                Vector4 rect = AnimationSheet_Rect(
                    data.effectData.animationSheetCountX,
                    data.effectData.animationSheetCountY,
                    data.effectData.animationSheetLoop,
                    data.effectData.animationSheetSingleRow,
                    data.effectData.animationSheetSingleRowIndex,
                    data.effectData.animationSheetStartFrame,
                    Time.realtimeSinceStartup);

                mat.SetVector("rectAnimationSheet", rect);
            }
            else if (node.sprite != null)
            {
                Rect r = SWCommon.SpriteRect01(node.sprite);
                mat.SetVector("rectAnimationSheet", new Vector4(r.x, r.y, r.width, r.height));
            }
            else
            {
                mat.SetVector("rectAnimationSheet", new Vector4(0, 0, 1, 1));
            }
        }
コード例 #2
0
        protected override void DrawNodeWindow(int id)
        {
            base.DrawNodeWindow(id);
            if (SWWindowMain.Instance.data.shaderType == SWShaderType.normal)
            {
                if (texture != null)
                {
                    GUI.DrawTexture(rectArea, texture);
                }
            }
            else if (SWWindowMain.Instance.data.shaderType == SWShaderType.sprite ||
                     SWWindowMain.Instance.data.shaderType == SWShaderType.ui || SWWindowMain.Instance.data.shaderType == SWShaderType.ngui_ui2dSprite)
            {
                if (sprite != null)
                {
                    Rect rect = SWCommon.SpriteRect01(sprite);
                    Graphics.DrawTexture(rectArea, sprite.texture, rect, 0, 0, 0, 0);
                }
            }
            else if (SWWindowMain.Instance.data.shaderType == SWShaderType.uiFont)
            {
                GUI.Label(rectArea, "TEXT", SWEditorUI.Style_Get(SWCustomStyle.eTxtRoot));
            }


            Rect rL = new Rect(gap, NodeHeight - 1.84f * (gap + buttonHeight), contentWidth * 0.5f, buttonHeight);
            Rect rR = new Rect(gap + contentWidth * 0.5f, NodeHeight - 1.84f * (gap + buttonHeight), contentWidth * 0.5f, 0.8f * buttonHeight);

            GUI.Label(rL, "Depth", SWEditorUI.Style_Get(SWCustomStyle.eTxtSmallLight));
            var dep = EditorGUI.IntField(rR, "", data.depth);

            if (dep != 0 && dep != data.depth)
            {
                SWUndo.Record(this);
                data.depth = dep;
            }

            if (texture != null)
            {
                if (GUI.Button(rectBotButton, "Edit", SWEditorUI.MainSkin.button))
                {
                    SWWindowEffectDummy.ShowEditor(this);
                }
            }
            DrawNodeWindowEnd();
        }