// Property -------------------------------------------------------------------------
	public bool ShowPopupWindow(NcCurveAnimation ncCurveAni, int nIndex, bool bSaveDialog)
	{
		m_CurrentCurveAnimation = ncCurveAni;
		m_OriCurveInfoIndex		= nIndex;

		if (m_CurrentCurveAnimation == null)
		{
			Debug.LogError("ncCurveAni is null");
			return false;
		}

		// Save Hint Box
		m_bDrawRedProject		= bSaveDialog;
		m_bDrawRedBottomButtom	= bSaveDialog;

		// backup
		m_OriCurveInfo = m_CurrentCurveAnimation.GetCurveInfo(nIndex).GetClone();

		m_nOriMaxObjectColumn		= 3;
		m_fButtonAspect				= FXMakerLayout.m_fScrollButtonAspect;
		m_SelectedTransform			= m_CurrentCurveAnimation.transform;
		m_SelCurveInfo				= null;
		m_PrefsName					= "NcInfoCurve";
		m_DefaultProjectName		= m_DefaultFileName;
		m_bFixedOptionRecursively	= true;
		m_bOptionRecursively		= false;
		m_bDisableOptionShowName	= true;
		bool reValue = base.ShowPopupWindow(ncCurveAni, bSaveDialog);

		// default nGroupIndex
		if (m_bOnlyCurve == false)
			m_nGroupIndex = (int)m_CurrentCurveAnimation.GetCurveInfo(nIndex).m_ApplyType+1;

		return reValue;
	}
예제 #2
0
    // ----------------------------------------------------------------------------------------------------------
    protected override void SetActiveObject(int nObjectIndex)
    {
        if (nObjectIndex < 0 || m_nObjectCount <= nObjectIndex)
        {
            return;
        }

        NcCurveAnimation.NcInfoCurve selCurveInfo = m_CurveInfos[nObjectIndex];

        if (m_bSaveDialog == false)
        {
            // 같은것 재클릭
            if (m_nObjectIndex == nObjectIndex)
            {
                FXMakerMain.inst.CreateCurrentInstanceEffect(true);
                return;
            }

            SetCurveAni(selCurveInfo);
            FXMakerMain.inst.CreateCurrentInstanceEffect(true);
        }

        m_nObjectIndex           = nObjectIndex;
        m_nSelObjectProjectIndex = m_nProjectIndex;
        m_nSelObjectGroupIndex   = (m_bOptionRecursively ? -1 : m_nGroupIndex);
        m_SelObjectContent       = new GUIContent(m_ObjectContents[nObjectIndex].text, m_ObjectContents[nObjectIndex].image, m_ObjectContents[nObjectIndex].tooltip);
    }
예제 #3
0
 public int AddCurveInfo(NcCurveAnimation.NcInfoCurve addCurveInfo)
 {
     if (this.m_CurveInfoList == null)
     {
         this.m_CurveInfoList = new List <NcCurveAnimation.NcInfoCurve>();
     }
     this.m_CurveInfoList.Add(addCurveInfo.GetClone());
     return(this.m_CurveInfoList.Count - 1);
 }
예제 #4
0
 private float GetChildNextColorValue(NcCurveAnimation.NcInfoCurve curveInfo, int nIndex, float fValue, int arrayIndex)
 {
     if (curveInfo.m_bApplyOption[nIndex])
     {
         float result = fValue - curveInfo.m_ChildBeforeColorValues[arrayIndex][nIndex];
         curveInfo.m_ChildBeforeColorValues[arrayIndex][nIndex] = fValue;
         return(result);
     }
     return(0f);
 }
예제 #5
0
 public NcCurveAnimation.NcInfoCurve SetCurveInfo(int nIndex, NcCurveAnimation.NcInfoCurve newInfo)
 {
     if (this.m_CurveInfoList == null || nIndex < 0 || this.m_CurveInfoList.get_Count() <= nIndex)
     {
         return(null);
     }
     NcCurveAnimation.NcInfoCurve result = this.m_CurveInfoList.get_Item(nIndex);
     this.m_CurveInfoList.set_Item(nIndex, newInfo);
     return(result);
 }
예제 #6
0
 private float GetNextValue(NcCurveAnimation.NcInfoCurve curveInfo, int nIndex, float fValue)
 {
     if (curveInfo.m_bApplyOption[nIndex])
     {
         float result = fValue - curveInfo.m_BeforeValue[nIndex];
         curveInfo.m_BeforeValue[nIndex] = fValue;
         return(result);
     }
     return(0f);
 }
예제 #7
0
 public NcCurveAnimation.NcInfoCurve SetCurveInfo(int nIndex, NcCurveAnimation.NcInfoCurve newInfo)
 {
     if (this.m_CurveInfoList == null || nIndex < 0 || this.m_CurveInfoList.Count <= nIndex)
     {
         return(null);
     }
     NcCurveAnimation.NcInfoCurve result = this.m_CurveInfoList[nIndex];
     this.m_CurveInfoList[nIndex] = newInfo;
     return(result);
 }
예제 #8
0
 private float GetNextScale(NcCurveAnimation.NcInfoCurve curveInfo, int nIndex, float fValue)
 {
     if (curveInfo.m_bApplyOption[nIndex])
     {
         float num    = curveInfo.m_OriginalValue[nIndex] * (1f + fValue);
         float result = num - curveInfo.m_BeforeValue[nIndex];
         curveInfo.m_BeforeValue[nIndex] = num;
         return(result);
     }
     return(0f);
 }
 public bool CheckInvalidOption(int nSrcIndex)
 {
     NcCurveAnimation.NcInfoCurve curveInfo = this.GetCurveInfo(nSrcIndex);
     if (curveInfo != null)
     {
         if (curveInfo.m_ApplyType != NcCurveAnimation.NcInfoCurve.APPLY_TYPE.MATERIAL_COLOR && curveInfo.m_ApplyType != NcCurveAnimation.NcInfoCurve.APPLY_TYPE.SCALE)
         {
             bool arg_38_0 = curveInfo.m_ApplyType != NcCurveAnimation.NcInfoCurve.APPLY_TYPE.TEXTUREUV;
         }
     }
     return(false);
 }
예제 #10
0
 public void Fade(float time)
 {
     NcCurveAnimation.NcInfoCurve curve = new NcCurveAnimation.NcInfoCurve();
     curve.m_ApplyType = NcCurveAnimation.NcInfoCurve.APPLY_TYPE.MATERIAL_COLOR;
     curve.m_ToColor = new Vector4(0f, 0f, 0f, 0f);
     curve.m_bRecursively = true;
     curve.m_bApplyOption = new bool[] {false, false, false, true};
     curve.m_AniCurve = AnimationCurve.Linear(0f, 0f, 1f, 1f);
     var anim = gameObject.AddComponent<NcCurveAnimation>();
     anim.AddCurveInfo(curve);
     anim.m_fDurationTime = time;
 }
예제 #11
0
    void DrawCurve(int nIndex, Rect gridRect, int nColumn, int nRow, NcCurveAnimation.NcInfoCurve curveInfo, GUIStyle styleButton)
    {
        int   nMargin       = styleButton.margin.left;
        int   nImageMargin  = 3;
        float fButtonWidth  = (gridRect.width / m_nObjectColumn);
        float fButtonHeight = (m_fButtonAspect * fButtonWidth);

        Rect buttonRect = new Rect(fButtonWidth * nColumn + nMargin, fButtonHeight * nRow + nMargin, fButtonWidth - nMargin * 2, fButtonHeight - nMargin * 2);

        buttonRect = FXMakerLayout.GetOffsetRect(buttonRect, -nImageMargin);
        EditorGUIUtility.DrawCurveSwatch(buttonRect, curveInfo.m_AniCurve, null, Color.green, Color.black, curveInfo.GetFixedDrawRange());
    }
예제 #12
0
 public int AddCurveInfo()
 {
     NcCurveAnimation.NcInfoCurve ncInfoCurve = new NcCurveAnimation.NcInfoCurve();
     ncInfoCurve.m_AniCurve = AnimationCurve.EaseInOut(0f, 0f, 1f, 0f);
     ncInfoCurve.m_AniCurve.AddKey(0.5f, 0.5f);
     if (this.m_CurveInfoList == null)
     {
         this.m_CurveInfoList = new List <NcCurveAnimation.NcInfoCurve>();
     }
     this.m_CurveInfoList.Add(ncInfoCurve);
     return(this.m_CurveInfoList.Count - 1);
 }
예제 #13
0
 public int AddCurveInfo()
 {
     NcCurveAnimation.NcInfoCurve ncInfoCurve = new NcCurveAnimation.NcInfoCurve();
     ncInfoCurve.m_AniCurve  = AnimationCurve.Linear(0f, 0f, 1f, 1f);
     ncInfoCurve.m_ToColor   = Color.white;
     ncInfoCurve.m_ToColor.w = 0f;
     if (this.m_CurveInfoList == null)
     {
         this.m_CurveInfoList = new List <NcCurveAnimation.NcInfoCurve>();
     }
     this.m_CurveInfoList.Add(ncInfoCurve);
     return(this.m_CurveInfoList.Count - 1);
 }
    private void SetChildMaterialColor(NcCurveAnimation.NcInfoCurve curveInfo, float fValue, int arrayIndex)
    {
        Color color  = curveInfo.m_ToColor - curveInfo.m_ChildOriginalColorValues[arrayIndex];
        Color color2 = this.m_ChildRenderers[arrayIndex].material.GetColor(this.m_ChildColorNames[arrayIndex]);

        for (int i = 0; i < 4; i++)
        {
            int   index;
            float num = color2[index = i];
            color2[index] = num + this.GetChildNextColorValue(curveInfo, i, color[i] * fValue, arrayIndex);
        }
        this.m_ChildRenderers[arrayIndex].material.SetColor(this.m_ChildColorNames[arrayIndex], color2);
    }
예제 #15
0
    public void Fade(float time)
    {
        NcCurveAnimation.NcInfoCurve curve = new NcCurveAnimation.NcInfoCurve();
        curve.m_ApplyType    = NcCurveAnimation.NcInfoCurve.APPLY_TYPE.MATERIAL_COLOR;
        curve.m_ToColor      = new Vector4(0f, 0f, 0f, 0f);
        curve.m_bRecursively = true;
        curve.m_bApplyOption = new bool[] { false, false, false, true };
        curve.m_AniCurve     = AnimationCurve.Linear(0f, 0f, 1f, 1f);
        var anim = gameObject.AddComponent <NcCurveAnimation>();

        anim.AddCurveInfo(curve);
        anim.m_fDurationTime = time;
    }
예제 #16
0
    private void SetChildMaterialColor(NcCurveAnimation.NcInfoCurve curveInfo, float fValue, int arrayIndex)
    {
        Color color  = curveInfo.m_ToColor - curveInfo.m_ChildOriginalColorValues[arrayIndex];
        Color color2 = this.m_ChildRenderers[arrayIndex].get_material().GetColor(this.m_ChildColorNames[arrayIndex]);

        for (int i = 0; i < 4; i++)
        {
            int   num;
            int   expr_49 = num = i;
            float num2    = color2.get_Item(num);
            color2.set_Item(expr_49, num2 + this.GetChildNextColorValue(curveInfo, i, color.get_Item(i) * fValue, arrayIndex));
        }
        this.m_ChildRenderers[arrayIndex].get_material().SetColor(this.m_ChildColorNames[arrayIndex], color2);
    }
예제 #17
0
    void DeleteCurveInfo(int nIndex)
    {
        GameObject saveObj = (GameObject)PrefabUtility.InstantiatePrefab(m_CurveAniObjects[m_nProjectIndex]);

        if (m_bOnlyCurve)
        {
            NcCurveAnimation saveCom = saveObj.GetComponent <NcCurveAnimation>();
            if (saveCom != null)
            {
                saveCom.DeleteCurveInfo(m_CurveInfos[nIndex].m_nTag);
            }
        }
        else
        {
            NcCurveAnimation[]           curveAnis    = saveObj.GetComponents <NcCurveAnimation>();
            NcCurveAnimation.NcInfoCurve delCurveInfo = m_CurveInfos[nIndex];

            foreach (NcCurveAnimation curveAni in curveAnis)
            {
                List <NcCurveAnimation.NcInfoCurve> curveInfoList = curveAni.m_CurveInfoList;
                for (int n = 0; n < curveInfoList.Count; n++)
                {
                    NcCurveAnimation.NcInfoCurve curveInfo = curveInfoList[n];
                    if (curveInfo.m_ApplyType == delCurveInfo.m_ApplyType && curveInfo.m_nTag == delCurveInfo.m_nTag)
                    {
                        curveInfoList.Remove(curveInfo);
                        break;
                    }
                }
            }
        }

        PrefabUtility.ReplacePrefab(saveObj, m_CurveAniObjects[m_nProjectIndex]);
        FXMakerAsset.AssetDatabaseSaveAssets();
        DestroyImmediate(saveObj);

        // update scrolllist
        int nObjectIndex = m_nObjectIndex;

        if (nIndex < m_nObjectIndex)
        {
            nObjectIndex = m_nObjectIndex - 1;
        }
        if (nIndex == m_nObjectIndex)
        {
            nObjectIndex = -1;
        }
        LoadObjects();
        m_nObjectIndex = nObjectIndex;
    }
예제 #18
0
    void UndoCurveAni()
    {
        // select init
        m_nObjectIndex           = -1;
        m_nSelObjectGroupIndex   = -1;
        m_nSelObjectProjectIndex = -1;
        m_SelObjectContent       = null;
        m_SelCurveInfo           = null;
        FXMakerMain.inst.CreateCurrentInstanceEffect(true);

        // Restore
        m_CurrentCurveAnimation.SetCurveInfo(m_OriCurveInfoIndex, m_OriCurveInfo.GetClone());
        m_SelCurveInfo = null;
    }
예제 #19
0
 void SetCurveAni(NcCurveAnimation.NcInfoCurve selCurveInfo)
 {
     // copy
     if (m_bOnlyCurve)
     {
         m_CurrentCurveAnimation.GetCurveInfo(m_OriCurveInfoIndex).m_AniCurve = selCurveInfo.GetClone().m_AniCurve;
         m_SelCurveInfo = selCurveInfo;
     }
     else
     {
         m_CurrentCurveAnimation.SetCurveInfo(m_OriCurveInfoIndex, selCurveInfo.GetClone());
         m_SelCurveInfo = selCurveInfo;
     }
 }
예제 #20
0
 public void CopyTo(NcCurveAnimation.NcInfoCurve target)
 {
     target.m_AniCurve = new AnimationCurve(this.m_AniCurve.keys);
     target.m_AniCurve.postWrapMode = this.m_AniCurve.postWrapMode;
     target.m_AniCurve.preWrapMode  = this.m_AniCurve.preWrapMode;
     target.m_bEnabled  = this.m_bEnabled;
     target.m_ApplyType = this.m_ApplyType;
     Array.Copy(this.m_bApplyOption, target.m_bApplyOption, this.m_bApplyOption.Length);
     target.m_fValueScale  = this.m_fValueScale;
     target.m_bRecursively = this.m_bRecursively;
     target.m_ToColor      = this.m_ToColor;
     target.m_nTag         = this.m_nTag;
     target.m_nSortGroup   = this.m_nSortGroup;
 }
예제 #21
0
 public void SortCurveInfo()
 {
     if (this.m_CurveInfoList == null)
     {
         return;
     }
     this.m_CurveInfoList.Sort(new NcCurveAnimation.NcComparerCurve());
     using (List <NcCurveAnimation.NcInfoCurve> .Enumerator enumerator = this.m_CurveInfoList.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             NcCurveAnimation.NcInfoCurve current = enumerator.get_Current();
             current.m_nSortGroup = NcCurveAnimation.NcComparerCurve.GetSortGroup(current);
         }
     }
 }
예제 #22
0
    private bool ContainsCurve(NcCurveAnimation.NcInfoCurve.APPLY_TYPE type)
    {
        int count = this.m_CurveInfoList.Count;

        for (int i = 0; i < count; i++)
        {
            NcCurveAnimation.NcInfoCurve ncInfoCurve = this.m_CurveInfoList[i];
            if (ncInfoCurve.m_bEnabled)
            {
                if (ncInfoCurve.m_ApplyType == type)
                {
                    return(true);
                }
            }
        }
        return(false);
    }
예제 #23
0
 public void CopyTo(NcCurveAnimation target, bool bCurveOnly)
 {
     target.m_CurveInfoList = new List <NcCurveAnimation.NcInfoCurve>();
     using (List <NcCurveAnimation.NcInfoCurve> .Enumerator enumerator = this.m_CurveInfoList.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             NcCurveAnimation.NcInfoCurve current = enumerator.get_Current();
             target.m_CurveInfoList.Add(current.GetClone());
         }
     }
     if (!bCurveOnly)
     {
         target.m_fDelayTime    = this.m_fDelayTime;
         target.m_fDurationTime = this.m_fDurationTime;
     }
 }
예제 #24
0
 public NcCurveAnimation.NcInfoCurve GetClone()
 {
     NcCurveAnimation.NcInfoCurve ncInfoCurve = new NcCurveAnimation.NcInfoCurve();
     ncInfoCurve.m_AniCurve = new AnimationCurve(this.m_AniCurve.keys);
     ncInfoCurve.m_AniCurve.postWrapMode = this.m_AniCurve.postWrapMode;
     ncInfoCurve.m_AniCurve.preWrapMode  = this.m_AniCurve.preWrapMode;
     ncInfoCurve.m_bEnabled  = this.m_bEnabled;
     ncInfoCurve.m_CurveName = this.m_CurveName;
     ncInfoCurve.m_ApplyType = this.m_ApplyType;
     Array.Copy(this.m_bApplyOption, ncInfoCurve.m_bApplyOption, this.m_bApplyOption.Length);
     ncInfoCurve.m_fValueScale  = this.m_fValueScale;
     ncInfoCurve.m_bRecursively = this.m_bRecursively;
     ncInfoCurve.m_ToColor      = this.m_ToColor;
     ncInfoCurve.m_nTag         = this.m_nTag;
     ncInfoCurve.m_nSortGroup   = this.m_nSortGroup;
     return(ncInfoCurve);
 }
예제 #25
0
 public NcCurveAnimation.NcInfoCurve GetCurveInfo(string curveName)
 {
     if (this.m_CurveInfoList == null)
     {
         return(null);
     }
     using (List <NcCurveAnimation.NcInfoCurve> .Enumerator enumerator = this.m_CurveInfoList.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             NcCurveAnimation.NcInfoCurve current = enumerator.get_Current();
             if (current.m_CurveName == curveName)
             {
                 return(current);
             }
         }
     }
     return(null);
 }
예제 #26
0
    // Property -------------------------------------------------------------------------
    public bool ShowPopupWindow(NcCurveAnimation ncCurveAni, int nIndex, bool bSaveDialog)
    {
        m_CurrentCurveAnimation = ncCurveAni;
        m_OriCurveInfoIndex     = nIndex;

        if (m_CurrentCurveAnimation == null)
        {
            Debug.LogError("ncCurveAni is null");
            return(false);
        }

        // Save Hint Box
        m_bDrawRedProject      = bSaveDialog;
        m_bDrawRedBottomButtom = bSaveDialog;

        // backup
        m_OriCurveInfo = m_CurrentCurveAnimation.GetCurveInfo(nIndex).GetClone();

        m_nOriMaxObjectColumn     = 3;
        m_fButtonAspect           = FXMakerLayout.m_fScrollButtonAspect;
        m_SelectedTransform       = m_CurrentCurveAnimation.transform;
        m_SelCurveInfo            = null;
        m_PrefsName               = "NcInfoCurve";
        m_DefaultProjectName      = m_DefaultFileName;
        m_bFixedOptionRecursively = true;
        m_bOptionRecursively      = false;
        m_bDisableOptionShowName  = true;
        bool reValue = base.ShowPopupWindow(ncCurveAni, bSaveDialog);

        // default nGroupIndex
        if (m_bOnlyCurve == false)
        {
            m_nGroupIndex = (int)m_CurrentCurveAnimation.GetCurveInfo(nIndex).m_ApplyType + 1;
        }

        return(reValue);
    }
    string GetCurveInfo(NcCurveAnimation.NcInfoCurve curveInfo, string subDir)
    {
        if (curveInfo != null)
        {
            if (m_bOnlyCurve)
            {
                return(string.Format("- SavePrefab: {0}", subDir));
            }
            else
            {
                string option1 = "";
                string option2 = "";

                for (int n = 0; n < curveInfo.GetValueCount(); n++)
                {
                    option1 += string.Format("{0}({1})  ", curveInfo.GetValueName(n), (curveInfo.m_bApplyOption[n] ? "O" : "  "));
                }
                if (curveInfo.m_ApplyType == NcCurveAnimation.NcInfoCurve.APPLY_TYPE.MATERIAL_COLOR)
                {
                    option2 = "To Color: " + curveInfo.m_ToColor.ToString() + "\n- Recursively: " + curveInfo.m_bRecursively.ToString();
                }
                else
                if (curveInfo.m_ApplyType == NcCurveAnimation.NcInfoCurve.APPLY_TYPE.MESH_COLOR)
                {
                    option2 = "From Color: " + curveInfo.m_FromColor.ToString() + "To Color: " + curveInfo.m_ToColor.ToString() + "\n- Recursively: " + curveInfo.m_bRecursively.ToString();
                }
                else
                {
                    option2 = "Value Scale: " + curveInfo.m_fValueScale.ToString();
                }


                return(string.Format("- {0}  {1}\n- {2}\n- SavePrefab: {3}", curveInfo.m_ApplyType.ToString(), option1, option2, subDir));
            }
        }
        return("");
    }
예제 #28
0
    private void UpdateAnimation(float fElapsedRate)
    {
        this.m_fElapsedRate = fElapsedRate;
        int count = this.m_CurveInfoList.Count;

        for (int i = 0; i < count; i++)
        {
            NcCurveAnimation.NcInfoCurve ncInfoCurve = this.m_CurveInfoList[i];
            if (ncInfoCurve.m_bEnabled)
            {
                float num = ncInfoCurve.m_AniCurve.Evaluate(this.m_fElapsedRate);
                if (ncInfoCurve.m_ApplyType != NcCurveAnimation.NcInfoCurve.APPLY_TYPE.COLOR)
                {
                    num *= ncInfoCurve.m_fValueScale;
                }
                switch (ncInfoCurve.m_ApplyType)
                {
                case NcCurveAnimation.NcInfoCurve.APPLY_TYPE.POSITION:
                    if (ncInfoCurve.m_bApplyOption[3])
                    {
                        Vector3 zero = Vector3.zero;
                        zero.x = this.GetNextValue(ncInfoCurve, 0, num);
                        zero.y = this.GetNextValue(ncInfoCurve, 1, num);
                        zero.z = this.GetNextValue(ncInfoCurve, 2, num);
                        this.m_Transform.position += zero;
                    }
                    else
                    {
                        Vector3 zero2 = Vector3.zero;
                        zero2.x = this.GetNextValue(ncInfoCurve, 0, num);
                        zero2.y = this.GetNextValue(ncInfoCurve, 1, num);
                        zero2.z = this.GetNextValue(ncInfoCurve, 2, num);
                        this.m_Transform.localPosition += zero2;
                    }
                    break;

                case NcCurveAnimation.NcInfoCurve.APPLY_TYPE.ROTATION:
                    if (ncInfoCurve.m_bApplyOption[3])
                    {
                        this.m_Transform.rotation *= Quaternion.Euler(this.GetNextValue(ncInfoCurve, 0, num), this.GetNextValue(ncInfoCurve, 1, num), this.GetNextValue(ncInfoCurve, 2, num));
                    }
                    else
                    {
                        Quaternion rhs = Quaternion.Euler(this.GetNextValue(ncInfoCurve, 0, num), this.GetNextValue(ncInfoCurve, 1, num), this.GetNextValue(ncInfoCurve, 2, num));
                        this.m_Transform.localRotation *= rhs;
                    }
                    break;

                case NcCurveAnimation.NcInfoCurve.APPLY_TYPE.SCALE:
                {
                    Vector3 zero3 = Vector3.zero;
                    zero3.x = this.GetNextScale(ncInfoCurve, 0, num);
                    zero3.y = this.GetNextScale(ncInfoCurve, 1, num);
                    zero3.z = this.GetNextScale(ncInfoCurve, 2, num);
                    this.m_Transform.localScale += zero3;
                    break;
                }

                case NcCurveAnimation.NcInfoCurve.APPLY_TYPE.COLOR:
                    if (ncInfoCurve.m_bRecursively)
                    {
                        if (this.m_ChildColorNames != null && this.m_ChildColorNames.Length >= 0)
                        {
                            for (int j = 0; j < this.m_ChildColorNames.Length; j++)
                            {
                                if (this.m_ChildColorNames[j] != null && this.m_ChildRenderers[j] != null)
                                {
                                    this.SetChildMaterialColor(ncInfoCurve, num, j);
                                }
                            }
                        }
                    }
                    else if (this.thisRenderer != null && this.m_ColorName != null)
                    {
                        if (this.m_MainMaterial == null)
                        {
                            this.m_MainMaterial            = this.thisRenderer.material;
                            this.m_MainMaterialOriginColor = this.m_MainMaterial.GetColor(this.m_ColorName);
                        }
                        Color color  = ncInfoCurve.m_ToColor - ncInfoCurve.m_OriginalValue;
                        Color color2 = this.m_MainMaterial.GetColor(this.m_ColorName);
                        for (int k = 0; k < 4; k++)
                        {
                            int   index;
                            int   expr_325 = index = k;
                            float num2     = color2[index];
                            color2[expr_325] = num2 + this.GetNextValue(ncInfoCurve, k, color[k] * num);
                        }
                        this.m_MainMaterial.SetColor(this.m_ColorName, color2);
                    }
                    break;

                case NcCurveAnimation.NcInfoCurve.APPLY_TYPE.TEXTUREUV:
                    if (this.m_NcUvAnimation)
                    {
                        this.m_NcUvAnimation.m_fScrollSpeedX += this.GetNextValue(ncInfoCurve, 0, num);
                        this.m_NcUvAnimation.m_fScrollSpeedY += this.GetNextValue(ncInfoCurve, 1, num);
                    }
                    break;
                }
            }
        }
        if (this.m_fDurationTime != 0f && 1f < this.m_fElapsedRate)
        {
            if (!base.IsEndAnimation())
            {
                base.OnEndAnimation();
            }
            if (this.m_bAutoDestruct)
            {
                base.gameObject.SetActive(false);
            }
        }
    }
예제 #29
0
 public bool CheckInvalidOption(int nSrcIndex)
 {
     NcCurveAnimation.NcInfoCurve curveInfo = this.GetCurveInfo(nSrcIndex);
     return(curveInfo != null && (curveInfo.m_ApplyType != NcCurveAnimation.NcInfoCurve.APPLY_TYPE.COLOR && curveInfo.m_ApplyType != NcCurveAnimation.NcInfoCurve.APPLY_TYPE.SCALE && curveInfo.m_ApplyType != NcCurveAnimation.NcInfoCurve.APPLY_TYPE.TEXTUREUV) && false);
 }
	void SetCurveAni(NcCurveAnimation.NcInfoCurve selCurveInfo)
	{
		// copy
		if (m_bOnlyCurve)
		{
			m_CurrentCurveAnimation.GetCurveInfo(m_OriCurveInfoIndex).m_AniCurve = selCurveInfo.GetClone().m_AniCurve;
			m_SelCurveInfo = selCurveInfo;
		} else {
			m_CurrentCurveAnimation.SetCurveInfo(m_OriCurveInfoIndex, selCurveInfo.GetClone());
			m_SelCurveInfo = selCurveInfo;
		}
	}
예제 #31
0
    private void UpdateAnimation(float fElapsedRate)
    {
        this.m_fElapsedRate = fElapsedRate;
        using (List <NcCurveAnimation.NcInfoCurve> .Enumerator enumerator = this.m_CurveInfoList.GetEnumerator())
        {
            while (enumerator.MoveNext())
            {
                NcCurveAnimation.NcInfoCurve current = enumerator.get_Current();
                if (current.m_bEnabled)
                {
                    float num = current.m_AniCurve.Evaluate(this.m_fElapsedRate);
                    if (current.m_ApplyType != NcCurveAnimation.NcInfoCurve.APPLY_TYPE.MATERIAL_COLOR && current.m_ApplyType != NcCurveAnimation.NcInfoCurve.APPLY_TYPE.MESH_COLOR)
                    {
                        num *= current.m_fValueScale;
                    }
                    switch (current.m_ApplyType)
                    {
                    case NcCurveAnimation.NcInfoCurve.APPLY_TYPE.POSITION:
                        if (current.m_bApplyOption[3])
                        {
                            this.m_Transform.position += new Vector3(this.GetNextValue(current, 0, num), this.GetNextValue(current, 1, num), this.GetNextValue(current, 2, num));
                        }
                        else
                        {
                            this.m_Transform.localPosition += new Vector3(this.GetNextValue(current, 0, num), this.GetNextValue(current, 1, num), this.GetNextValue(current, 2, num));
                        }
                        break;

                    case NcCurveAnimation.NcInfoCurve.APPLY_TYPE.ROTATION:
                        if (current.m_bApplyOption[3])
                        {
                            this.m_Transform.rotation *= Quaternion.Euler(this.GetNextValue(current, 0, num), this.GetNextValue(current, 1, num), this.GetNextValue(current, 2, num));
                        }
                        else
                        {
                            this.m_Transform.localRotation *= Quaternion.Euler(this.GetNextValue(current, 0, num), this.GetNextValue(current, 1, num), this.GetNextValue(current, 2, num));
                        }
                        break;

                    case NcCurveAnimation.NcInfoCurve.APPLY_TYPE.SCALE:
                        this.m_Transform.localScale += new Vector3(this.GetNextScale(current, 0, num), this.GetNextScale(current, 1, num), this.GetNextScale(current, 2, num));
                        break;

                    case NcCurveAnimation.NcInfoCurve.APPLY_TYPE.MATERIAL_COLOR:
                        if (current.m_bRecursively)
                        {
                            if (this.m_ChildColorNames != null && this.m_ChildColorNames.Length >= 0)
                            {
                                for (int i = 0; i < this.m_ChildColorNames.Length; i++)
                                {
                                    if (this.m_ChildColorNames[i] != null && this.m_ChildRenderers[i] != null)
                                    {
                                        this.SetChildMaterialColor(current, num, i);
                                    }
                                }
                            }
                        }
                        else if (base.GetRenderer() != null && this.m_ColorName != null)
                        {
                            if (this.m_MainMaterial == null)
                            {
                                this.m_MainMaterial = base.GetRenderer().material;
                                base.AddRuntimeMaterial(this.m_MainMaterial);
                            }
                            Color color  = current.m_ToColor - current.m_OriginalValue;
                            Color color2 = this.m_MainMaterial.GetColor(this.m_ColorName);
                            for (int j = 0; j < 4; j++)
                            {
                                int   index;
                                int   expr_2CD = index = j;
                                float num2     = color2[index];
                                color2[expr_2CD] = num2 + this.GetNextValue(current, j, color[j] * num);
                            }
                            this.m_MainMaterial.SetColor(this.m_ColorName, color2);
                        }
                        break;

                    case NcCurveAnimation.NcInfoCurve.APPLY_TYPE.TEXTUREUV:
                        if (this.m_NcUvAnimation)
                        {
                            this.m_NcUvAnimation.m_fScrollSpeedX += this.GetNextValue(current, 0, num);
                            this.m_NcUvAnimation.m_fScrollSpeedY += this.GetNextValue(current, 1, num);
                        }
                        break;

                    case NcCurveAnimation.NcInfoCurve.APPLY_TYPE.MESH_COLOR:
                    {
                        Color tarColor = Color.Lerp(current.m_FromColor, current.m_ToColor, num);
                        if (current.m_bRecursively)
                        {
                            if (this.m_ChildMeshFilters != null && this.m_ChildMeshFilters.Length >= 0)
                            {
                                for (int k = 0; k < this.m_ChildMeshFilters.Length; k++)
                                {
                                    this.ChangeMeshColor(this.m_ChildMeshFilters[k], tarColor);
                                }
                            }
                        }
                        else
                        {
                            this.ChangeMeshColor(this.m_MainMeshFilter, tarColor);
                        }
                        break;
                    }
                    }
                }
            }
        }
        if (this.m_fDurationTime != 0f && 1f < this.m_fElapsedRate)
        {
            if (!base.IsEndAnimation())
            {
                base.OnEndAnimation();
            }
            if (this.m_bAutoDestruct)
            {
                Object.DestroyObject(base.gameObject);
            }
        }
    }
	void UndoCurveAni()
	{
		// select init
		m_nObjectIndex			= -1;
		m_nSelObjectGroupIndex	= -1;
		m_nSelObjectProjectIndex= -1;
		m_SelObjectContent		= null;
		m_SelCurveInfo			= null;
		FXMakerMain.inst.CreateCurrentInstanceEffect(true);

		// Restore
		m_CurrentCurveAnimation.SetCurveInfo(m_OriCurveInfoIndex, m_OriCurveInfo.GetClone());
		m_SelCurveInfo = null;
	}
예제 #33
0
    private void InitAnimation()
    {
        this.m_fElapsedRate           = 0f;
        this.m_Transform              = base.transform;
        this.m_TransformScale         = this.m_Transform.localScale;
        this.m_TransformLocalPosition = this.m_Transform.localPosition;
        this.m_TransformLocalRotation = this.m_Transform.localRotation;
        int count = this.m_CurveInfoList.Count;

        for (int i = 0; i < count; i++)
        {
            NcCurveAnimation.NcInfoCurve ncInfoCurve = this.m_CurveInfoList[i];
            if (ncInfoCurve.m_bEnabled)
            {
                switch (ncInfoCurve.m_ApplyType)
                {
                case NcCurveAnimation.NcInfoCurve.APPLY_TYPE.POSITION:
                    ncInfoCurve.m_OriginalValue = Vector4.zero;
                    ncInfoCurve.m_BeforeValue   = ncInfoCurve.m_OriginalValue;
                    break;

                case NcCurveAnimation.NcInfoCurve.APPLY_TYPE.ROTATION:
                    ncInfoCurve.m_OriginalValue = Vector4.zero;
                    ncInfoCurve.m_BeforeValue   = ncInfoCurve.m_OriginalValue;
                    break;

                case NcCurveAnimation.NcInfoCurve.APPLY_TYPE.SCALE:
                    ncInfoCurve.m_OriginalValue = this.m_Transform.localScale;
                    ncInfoCurve.m_BeforeValue   = ncInfoCurve.m_OriginalValue;
                    break;

                case NcCurveAnimation.NcInfoCurve.APPLY_TYPE.COLOR:
                    if (ncInfoCurve.m_bRecursively)
                    {
                        this.m_ChildRenderers  = base.transform.GetComponentsInChildren <Renderer>(true);
                        this.m_ChildColorNames = new string[this.m_ChildRenderers.Length];
                        ncInfoCurve.m_ChildOriginalColorValues = new Vector4[this.m_ChildRenderers.Length];
                        ncInfoCurve.m_ChildBeforeColorValues   = new Vector4[this.m_ChildRenderers.Length];
                        for (int j = 0; j < this.m_ChildRenderers.Length; j++)
                        {
                            Renderer renderer = this.m_ChildRenderers[j];
                            this.m_ChildColorNames[j] = NcCurveAnimation.Ng_GetMaterialColorName(renderer.material);
                            if (this.m_ChildColorNames[j] != null)
                            {
                                ncInfoCurve.m_ChildOriginalColorValues[j] = renderer.material.GetColor(this.m_ChildColorNames[j]);
                            }
                            ncInfoCurve.m_ChildBeforeColorValues[j] = Vector4.zero;
                        }
                    }
                    else if (this.thisRenderer != null)
                    {
                        this.m_ColorName = NcCurveAnimation.Ng_GetMaterialColorName(this.thisRenderer.sharedMaterial);
                        if (this.m_ColorName != null)
                        {
                            ncInfoCurve.m_OriginalValue = this.thisRenderer.sharedMaterial.GetColor(this.m_ColorName);
                        }
                        ncInfoCurve.m_BeforeValue = Vector4.zero;
                    }
                    break;

                case NcCurveAnimation.NcInfoCurve.APPLY_TYPE.TEXTUREUV:
                    if (this.m_NcUvAnimation == null)
                    {
                        this.m_NcUvAnimation = base.GetComponent <NcUvAnimation>();
                    }
                    if (this.m_NcUvAnimation)
                    {
                        ncInfoCurve.m_OriginalValue = new Vector4(this.m_NcUvAnimation.m_fScrollSpeedX, this.m_NcUvAnimation.m_fScrollSpeedY, 0f, 0f);
                    }
                    ncInfoCurve.m_BeforeValue = ncInfoCurve.m_OriginalValue;
                    break;
                }
            }
        }
    }
예제 #34
0
    protected override void LoadObjects()
    {
        ArrayList infoList = new ArrayList();

        m_CurveInfos     = null;
        m_ObjectContents = null;
        m_nObjectCount   = 0;
        m_nObjectIndex   = -1;

        if (m_nGroupCount <= 0)
        {
            return;
        }

        GameObject currentObj = m_CurveAniObjects[m_nProjectIndex];

        if (m_bOnlyCurve)
        {
            NcCurveAnimation curveAnis = currentObj.GetComponent <NcCurveAnimation>();
            if (curveAnis != null)
            {
                List <NcCurveAnimation.NcInfoCurve> curveInfoList = curveAnis.m_CurveInfoList;
                for (int n = 0; n < curveInfoList.Count; n++)
                {
                    curveInfoList[n].m_nTag = n;
                    if (m_nGroupIndex == 0)
                    {
                        infoList.Add(curveInfoList[n]);
                    }
                    else
                    {
                        if (m_nGroupIndex == curveInfoList[n].m_nSortGroup)                                     // 1, 2, 3
                        {
                            infoList.Add(curveInfoList[n]);
                        }
                    }
                }
            }
        }
        else
        {
            NcCurveAnimation[] curveAnis = currentObj.GetComponents <NcCurveAnimation>();
            foreach (NcCurveAnimation curveAni in curveAnis)
            {
                List <NcCurveAnimation.NcInfoCurve> curveInfoList = curveAni.m_CurveInfoList;
                for (int n = 0; n < curveInfoList.Count; n++)
                {
                    NcCurveAnimation.NcInfoCurve curveInfo = curveInfoList[n];
                    curveInfo.m_nTag = n;
                    // Add CurveInfo
                    if (m_bSaveDialog)
                    {
                        if (m_OriCurveInfo.m_ApplyType == curveInfo.m_ApplyType)
                        {
                            infoList.Add(curveInfo);
                        }
                    }
                    else
                    {
                        if (0 < m_nGroupIndex)
                        {
                            if (m_nGroupIndex - 1 == (int)curveInfo.m_ApplyType)
                            {
                                infoList.Add(curveInfo);
                            }
                        }
                        else
                        {
                            infoList.Add(curveInfo);
                        }
                    }
                }
            }
        }

        m_CurveInfos   = NgConvert.ToArray <NcCurveAnimation.NcInfoCurve>(infoList);
        m_nObjectCount = infoList.Count;

        // build contents
        string subDir = AssetDatabase.GetAssetPath(m_CurveAniObjects[m_nProjectIndex]);

        subDir = NgFile.PathSeparatorNormalize(subDir).Replace(m_LoadDirectory, "");

        m_ObjectContents = new GUIContent[m_nObjectCount];
        for (int n = 0; n < m_nObjectCount; n++)
        {
            if (m_ObjectContents[n] == null)
            {
                m_ObjectContents[n]         = new GUIContent();
                m_ObjectContents[n].text    = "";
                m_ObjectContents[n].tooltip = FXMakerTooltip.Tooltip(GetCurveInfo(m_CurveInfos[n], subDir));
            }
        }
        Debug.Log("m_nObjectCount " + m_nObjectCount);
    }