Example #1
0
    // Loop Function --------------------------------------------------------------------
    void Awake()
    {
        m_bEndNcCurveAnimation = false; // disable

        m_fStartTime       = 0;
        m_NcCurveAnimation = null;
    }
 private void Start()
 {
     if (this.m_bEndNcCurveAnimation)
     {
         this.m_NcCurveAnimation = base.GetComponent <NcCurveAnimation>();
     }
 }
	// 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;
	}
Example #4
0
 void Start()
 {
     if (m_bEndNcCurveAnimation)
     {
         m_NcCurveAnimation = GetComponent <NcCurveAnimation>();
     }
 }
Example #5
0
 public void ShowNcCurveAnimationPopup(NcCurveAnimation selObj, bool bSaveDialog)
 {
     if (SetFxmFolderPopup(typeof(FxmFolderPopup_NcCurveAnimation)))
     {
         (m_CurrentFolderPopup as FxmFolderPopup_NcCurveAnimation).ShowPopupWindow(selObj, bSaveDialog);
     }
 }
Example #6
0
 public void ShowNcInfoCurvePopup(NcCurveAnimation selObj, int nSelIndex, bool bSaveDialog)
 {
     if (SetFxmFolderPopup(typeof(FxmFolderPopup_NcInfoCurve)))
     {
         (m_CurrentFolderPopup as FxmFolderPopup_NcInfoCurve).ShowPopupWindow(selObj, nSelIndex, bSaveDialog);
     }
 }
Example #7
0
	// Loop Function --------------------------------------------------------------------
	void Awake()
	{
 		m_bEndNcCurveAnimation	= false;	// disable

		m_fStartTime			= 0;
		m_NcCurveAnimation		= null;
	}
	// Use this for initialization
	void Start () {
		objPlayer = (GameObject) GameObject.FindWithTag ("Player");
		objCamera = (GameObject) GameObject.FindWithTag("MainCamera");
		GameScript = (gameScript) objCamera.GetComponent( typeof(gameScript) );
		son1Script=(NcCurveAnimation)son1.GetComponent( typeof(NcCurveAnimation) );
		son4Script=(NcCurveAnimation)son4.GetComponent( typeof(NcCurveAnimation) );
		ptrScriptVariable = (VariableScript) objCamera.GetComponent( typeof(VariableScript) );
	}
Example #9
0
 private void Start()
 {
     this.m_fStartTime = NcEffectBehaviour.GetEngineTime();
     if (this.m_bEndNcCurveAnimation)
     {
         this.m_NcCurveAnimation = base.GetComponent <NcCurveAnimation>();
     }
 }
Example #10
0
 void Start()
 {
     m_fStartTime = GetEngineTime();
     if (m_bEndNcCurveAnimation)
     {
         m_NcCurveAnimation = GetComponent <NcCurveAnimation>();
     }
 }
    void SetCurveAni(GameObject selCurveAniObj)
    {
        NcCurveAnimation ncCurveAni = selCurveAniObj.GetComponent <NcCurveAnimation>();

        m_SelCurveAniObject = selCurveAniObj;
        // copy
//      ncCurveAni.CopyTo(m_CurrentCurveAnimation, false);
        // append
        m_OriCurveAnimation.CopyTo(m_CurrentCurveAnimation, false);
        ncCurveAni.AppendTo(m_CurrentCurveAnimation, false);
    }
Example #12
0
 //控制nc脚本
 public void SetNCAni(bool bAni)
 {
     if (modelParent != null)
     {
         NcCurveAnimation nc = modelParent.GetComponent <NcCurveAnimation>();
         if (nc != null)
         {
             nc.enabled = bAni;
         }
     }
 }
Example #13
0
    // Use this for initialization
    void Start()
    {
        renderArray = this.GetComponentsInChildren <Renderer> ();
        ac          = this.GetComponentInChildren <NcCurveAnimation> ();


        if (transform.Find("EffectOffset") != null)
        {
            EffectOffset = transform.Find("EffectOffset").gameObject;
        }
    }
Example #14
0
 public void CopyTo(NcCurveAnimation target, bool bCurveOnly)
 {
     target.m_CurveInfoList = new List <NcCurveAnimation.NcInfoCurve>();
     foreach (NcCurveAnimation.NcInfoCurve current in this.m_CurveInfoList)
     {
         target.m_CurveInfoList.Add(current.GetClone());
     }
     if (!bCurveOnly)
     {
         target.m_fDelayTime    = this.m_fDelayTime;
         target.m_fDurationTime = this.m_fDurationTime;
     }
 }
Example #15
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;
    }
Example #16
0
    public void CopyTo(NcCurveAnimation target, bool bCurveOnly)
    {
        target.m_CurveInfoList = new List <NcInfoCurve>();
        for (int i = 0; i < m_CurveInfoList.Count; ++i)
        {
            target.m_CurveInfoList.Add(m_CurveInfoList[i].GetClone());
        }

        if (!bCurveOnly)
        {
            target.m_fDelayTime    = m_fDelayTime;
            target.m_fDurationTime = m_fDurationTime;
            //          target.m_bAutoDestruct	= m_bAutoDestruct;
        }
    }
Example #17
0
    public void CopyTo(NcCurveAnimation target, bool bCurveOnly)
    {
        target.m_CurveInfoList = new List <NcInfoCurve>();

        foreach (NcInfoCurve curveInfo in m_CurveInfoList)
        {
            target.m_CurveInfoList.Add(curveInfo.GetClone());
        }
        if (bCurveOnly == false)
        {
            target.m_fDelayTime    = m_fDelayTime;
            target.m_fDurationTime = m_fDurationTime;
//          target.m_bAutoDestruct	= m_bAutoDestruct;
        }
    }
Example #18
0
 public void AppendTo(NcCurveAnimation target, bool bCurveOnly)
 {
     if (target.m_CurveInfoList == null)
     {
         target.m_CurveInfoList = new List <NcInfoCurve>();
     }
     foreach (NcInfoCurve curve in this.m_CurveInfoList)
     {
         target.m_CurveInfoList.Add(curve.GetClone());
     }
     if (!bCurveOnly)
     {
         target.m_fDelayTime    = this.m_fDelayTime;
         target.m_fDurationTime = this.m_fDurationTime;
     }
 }
    // Property -------------------------------------------------------------------------
    public override bool ShowPopupWindow(Object selObj, bool bSaveDialog)
    {
        m_CurrentCurveAnimation = selObj as NcCurveAnimation;

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

        // Save Hint Box
        m_bDrawRedProject = bSaveDialog;
        m_bDrawRedGroup   = bSaveDialog;
        m_bDrawRedBottom  = bSaveDialog;

        // SaveDialog - Disable m_bOptionRecursively
        if (bSaveDialog)
        {
            m_SaveFilename            = "Save FileName";
            m_bFixedOptionRecursively = true;
            m_bOptionRecursively      = false;
        }
        else
        {
            m_bFixedOptionRecursively = false;
        }

        // create backup component
        m_OriCurveAnimation = gameObject.GetComponent <NcCurveAnimation>();
        if (m_OriCurveAnimation == null)
        {
            m_OriCurveAnimation         = gameObject.AddComponent <NcCurveAnimation>();
            m_OriCurveAnimation.enabled = false;
        }

        // backup
        m_CurrentCurveAnimation.CopyTo(m_OriCurveAnimation, false);

        m_nOriMaxObjectColumn  = 3;
        m_fButtonAspect        = FXMakerLayout.m_fScrollButtonAspect;
        m_SelectedTransform    = m_CurrentCurveAnimation.transform;
        m_PrefsName            = "NcCurveAnimation";
        m_BaseDefaultGroupName = m_DefaultGroupName;
        m_SelCurveAniObject    = null;
        return(base.ShowPopupWindow(selObj, bSaveDialog));
    }
Example #20
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;
     }
 }
	// Property -------------------------------------------------------------------------
	public override bool ShowPopupWindow(Object selObj, bool bSaveDialog)
	{
		m_CurrentCurveAnimation = selObj as NcCurveAnimation;

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

		// Save Hint Box
		m_bDrawRedProject		= bSaveDialog;
		m_bDrawRedGroup			= bSaveDialog;
		m_bDrawRedBottom		= bSaveDialog;

		// SaveDialog - Disable m_bOptionRecursively
		if (bSaveDialog)
		{
			m_SaveFilename				= "Save FileName";
			m_bFixedOptionRecursively	= true;
			m_bOptionRecursively		= false;
		} else m_bFixedOptionRecursively = false;

		// create backup component
		m_OriCurveAnimation = gameObject.GetComponent<NcCurveAnimation>();
		if (m_OriCurveAnimation == null)
		{
			m_OriCurveAnimation = gameObject.AddComponent<NcCurveAnimation>();
			m_OriCurveAnimation.enabled = false;
		}

		// backup
		m_CurrentCurveAnimation.CopyTo(m_OriCurveAnimation, false);

		m_nOriMaxObjectColumn		= 3;
		m_fButtonAspect				= FXMakerLayout.m_fScrollButtonAspect;
		m_SelectedTransform			= m_CurrentCurveAnimation.transform;
		m_PrefsName					= "NcCurveAnimation";
		m_BaseDefaultGroupName		= m_DefaultGroupName;
		m_SelCurveAniObject			= null;
		return base.ShowPopupWindow(selObj, bSaveDialog);
	}
Example #22
0
    public void CopyTo(NcCurveAnimation target, bool bCurveOnly)
    {
        target.m_CurveInfoList = new List <NcInfoCurve>();

        foreach (NcInfoCurve curveInfo in m_CurveInfoList)
        {
            target.m_CurveInfoList.Add(curveInfo.GetClone());
        }
        if (bCurveOnly == false)
        {
            target.m_fDelayTime    = m_fDelayTime;
            target.m_fDurationTime = m_fDurationTime;

#if UNITY_EDITOR
            target.m_fDelayFrame    = (int)(m_fDelayTime / NcFrameHelper.FixedSecondPerFrame);
            target.m_fDurationFrame = (int)(m_fDurationTime / NcFrameHelper.FixedSecondPerFrame);
#endif
//          target.m_bAutoDestruct	= m_bAutoDestruct;
        }
    }
    void SaveCurveAniToPrefabFile()
    {
        if (m_nProjectIndex < 0)
        {
            return;
        }

        if (m_DefaultSavePrefab == null)
        {
            Debug.LogError("FxmFolderPopup_NcCurveAnimation.m_DefaultSavePrefab is null");
            return;
        }

        string dstPath = NgFile.CombinePath(m_LoadDirectory, m_NcCurveAni_FileKeyword + m_SaveFilename + ".prefab");

        dstPath = NgAsset.CreateDefaultUniquePrefab(m_DefaultSavePrefab, dstPath);

        GameObject       newPrefab = NgAsset.LoadPrefab(dstPath);
        NcCurveAnimation newCom    = newPrefab.AddComponent <NcCurveAnimation>();

        m_CurrentCurveAnimation.CopyTo(newCom, false);
        FXMakerAsset.AssetDatabaseSaveAssets();
    }
Example #24
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);
    }
Example #25
0
	// Property -------------------------------------------------------------------------
	// Event Function -------------------------------------------------------------------
    void OnEnable()
    {
 		m_Sel = target as NcCurveAnimation;
 		m_UndoManager	= new FXMakerUndoManager(m_Sel, "NcCurveAnimation");
   }
    /*
     * /// <summary>
     * /// 코인이 점핑 애니메이션을 하게 한다.
     * /// </summary>
     * IEnumerator JumpingAnimEffect(Transform coinTrans)
     * {
     *  float JumpVelY = JumpingHeight;
     *  float GravityY = (JumpVelY * 2f) / JumpingDuration;
     *  float jumpTime = 0f;
     *  float delta;
     *
     *  Vector3 destPos = coinTrans.position;
     *  Vector3 pos = coinTrans.position;
     *
     *  while (jumpTime <= JumpingDuration)
     *  {
     *      pos = coinTrans.position;
     *
     *      delta = Time.deltaTime;
     *
     *      pos.y       += JumpVelY * delta;
     *      JumpVelY    -= GravityY * delta;
     *      jumpTime    += delta;
     *
     *      coinTrans.position = pos;
     *
     *      yield return null;
     *  }
     *
     *  coinTrans.position = destPos;
     * }
     */
    /// 코인 섭취시 대상으로 이동시키는 애니메이션.
    IEnumerator EatAnimEffect(Transform coinTrans, Transform target, float duration, float delay)
    {
        //yield return StartCoroutine( MoveToPosition(coinTrans, (Quaternion.AngleAxis( Random.Range(0, 360), Vector3.up ) * coinTrans.forward)+ coinTrans.position, delay - 0.33f) );
        if (CoinEff == null)
        {
            InitTweenAsset();
        }

        CoinEff.SetActive(true);
        SkinnedMeshRenderer meshRender = coinTrans.FindChild("coin024").GetComponent <SkinnedMeshRenderer>();
        Color color = meshRender.material.GetColor("_AddColor");

        color.a = 1f;
        meshRender.material.SetColor("_AddColor", color);

        for (int i = 0; i < CoinEff.transform.childCount; i++)
        {
            Transform tf = CoinEff.transform.GetChild(i);
            for (int j = 0; j < tf.childCount; j++)
            {
                NcUvAnimation    ncUv    = tf.GetChild(j).GetComponent <NcUvAnimation>();
                NcCurveAnimation ncCurve = tf.GetChild(j).GetComponent <NcCurveAnimation>();
                if (ncUv == null)
                {
                    continue;
                }

                ncCurve.enabled = true;
                ncUv.enabled    = true;
            }

            NcUvAnimation    _ncUv    = tf.GetComponent <NcUvAnimation>();
            NcCurveAnimation _ncCurve = tf.GetComponent <NcCurveAnimation>();
            if (_ncUv == null)
            {
                continue;
            }

            _ncCurve.enabled = true;
            _ncUv.enabled    = true;
        }

        for (int i = 0; i < Materials.Count; i++)
        {
            Color c = Materials[i].GetColor("_TintColor");
            c.a = MaterialAlphas[i];
            Materials[i].SetColor("_TintColor", c);
        }

        EventListner.instance.TriggerEvent("COIN_LOOTING", gold);
        //for(int i=0; i < CoinEffs.Length; i++)
        //{
        //    Renderer render = CoinEffs[i].renderer;
        //    Color partiC = render.material.GetColor("_TintColor");
        //    partiC.a = EffOriAlpha;
        //    render.material.SetColor("_TintColor", partiC);
        //}

        yield return(new WaitForSeconds(delay + 0.4f));

        animation.Play("coin_stop");
        //< UI위치로 변경
        //coinTrans.parent = UIMgr.instance.UICamera.camera.transform;
        //Vector3 spawnedPos = MathHelper.WorldToUIPosition(coinTrans.position);
        //coinTrans.transform.localPosition = new Vector3(spawnedPos.x, spawnedPos.y, -270);
        //coinTrans.transform.localScale = new Vector3(90, 90, 1);
        //coinTrans.transform.localRotation = Quaternion.identity;
        //NGUITools.SetLayer(coinTrans.gameObject, 8);

        /*
         * //coinTrans.position = Vector3.zero;
         * Vector3 upPos = new Vector3(0, 1f, 0);
         * //< 현재 위치에서부터 목표 위치까지 이동시킨다.
         * //Vector3 f3 = target.position - coinTrans.position;
         * float moveSpeed = 0;
         * while (true)
         * {
         *  Vector3 targetPos = target.position;
         *  targetPos.y += 1f;
         *  moveSpeed += 2f * Time.fixedDeltaTime;
         *  //if (10f < moveSpeed)
         *  //    moveSpeed = 10f;
         *
         *  int count = coinTrans.childCount-1;
         *  for (int i=0; i < coinTrans.childCount; i++)
         *  {
         *      if (!coinTrans.GetChild(i).name.Contains("aniBone"))
         *          continue;
         *      else if (Vector3.Distance(coinTrans.GetChild(i).position, targetPos) < 1f)
         *      {
         *          coinTrans.GetChild(i).GetComponent<TweenPosition>().enabled = false;
         *          --count;
         *          continue;
         *      }
         *
         *      TweenPosition tweenPos = coinTrans.GetChild(i).GetComponent<TweenPosition>();
         *      if (!tweenPos.enabled)
         *      {
         *          tweenPos.to = target.position;
         *          tweenPos.from = coinTrans.GetChild(i).position;
         *          tweenPos.ResetToBeginning();
         *          tweenPos.PlayForward();
         *      }
         *      //Vector3 offset = targetPos - coinTrans.GetChild(i).position;
         *      //coinTrans.GetChild(i).position += (offset.normalized * (moveSpeed*Time.fixedDeltaTime) );
         *  }
         *
         *  if (count <= 0)
         *      break;
         *
         *  //< 프레임을 좀더 딜레이 걸어준다.
         *  yield return null;
         * }
         */

        for (int i = 0; i < CoinEff.transform.childCount; i++)
        {
            Transform tf = CoinEff.transform.GetChild(i);
            for (int j = 0; j < tf.childCount; j++)
            {
                NcUvAnimation    ncUv    = tf.GetChild(j).GetComponent <NcUvAnimation>();
                NcCurveAnimation ncCurve = tf.GetChild(j).GetComponent <NcCurveAnimation>();
                if (ncUv == null)
                {
                    continue;
                }

                ncCurve.enabled = false;
                ncUv.enabled    = false;
            }

            NcUvAnimation    _ncUv    = tf.GetComponent <NcUvAnimation>();
            NcCurveAnimation _ncCurve = tf.GetComponent <NcCurveAnimation>();
            if (_ncUv == null)
            {
                continue;
            }

            _ncCurve.enabled = false;
            _ncUv.enabled    = false;
        }

        float alpha = 1f;//, alpha2 = EffOriAlpha;

        while (0 < alpha)
        {
            alpha -= (2f * Time.deltaTime);
            //alpha2 -= (1f * Time.deltaTime);

            Color c = meshRender.material.GetColor("_AddColor");
            c.a = alpha;
            meshRender.material.SetColor("_AddColor", c);

            for (int i = 0; i < MaterialAlphas.Count; i++)
            {
                //if (MaterialAlphas[i] < alpha)
                //    continue;

                Color partiC = Materials[i].GetColor("_TintColor");
                if (partiC.a <= 0)
                {
                    continue;
                }

                partiC.a -= 2f * Time.deltaTime;//alpha;
                Materials[i].SetColor("_TintColor", partiC);
            }

            yield return(null);
        }

        //EventListner.instance.TriggerEvent("COIN_LOOTING", gold);

        yield return(new WaitForEndOfFrame());

        //NGUITools.SetLayer(coinTrans.gameObject, 0);
        if (PoolManager.Pools.ContainsKey("InGameObj"))
        {
            PoolManager.Pools["InGameObj"].Despawn(transform);
        }
    }
Example #27
0
    public void compareLife()
    {
        float life = 0;

        for (int i = 0; i < eod.particleSystemList.Count; i++)
        {
            ParticleSystem ps      = eod.particleSystemList[i];
            float          maxTime = ps.duration + ps.startLifetime;
            life = ps.startDelay + maxTime;
            if (life > lifeTime)
            {
                lifeTime            = life;
                _checkPlayTimeIndex = i;
                checkType           = 1;
                //Log.info(ps.name+" startDelay:" + ps.startDelay + " startLifetime:" + ps.startLifetime);
            }
            //                 ParticleSystemRenderer psr = ps.renderer as ParticleSystemRenderer;
            //                 if (psr.renderMode == ParticleSystemRenderMode.Mesh)
            //                 {
            //                 }
        }

        for (int k = 0; k < eod.ncCurveAnimationList.Count; k++)
        {
            NcCurveAnimation ncca = eod.ncCurveAnimationList[k];
            life  = ncca.m_fDelayTime + ncca.m_fDurationTime;
            life *= _speed;
            if (life > lifeTime)
            {
                lifeTime            = life;
                _checkPlayTimeIndex = k;
                checkType           = 2;
            }
        }
        for (int k = 0; k < eod.ncSpriteAnimationList.Count; k++)
        {
            NcSpriteAnimation nc = eod.ncSpriteAnimationList[k];
            life  = nc.m_fDelayTime + nc.GetDurationTime();
            life *= _speed;
            if (life > lifeTime)
            {
                lifeTime            = life;
                _checkPlayTimeIndex = k;
                checkType           = 3;
            }
        }
        for (int k = 0; k < eod.animationList.Count; k++)
        {
            Animation ani = eod.animationList[k];
            foreach (AnimationState aniS in ani)
            {
                life                     = aniS.length;
                _animationState          = aniS;
                _animationState.wrapMode = WrapMode.ClampForever;
                break;
            }

            if (life > lifeTime)
            {
                lifeTime            = life;
                _checkPlayTimeIndex = k;
                checkType           = 4;
            }
        }
        //Log.info("lifeTime:" + _controller.lifeTime);
    }
Example #28
0
	void Start()
	{
		if (m_bEndNcCurveAnimation)
			m_NcCurveAnimation = GetComponent<NcCurveAnimation>();
	}
Example #29
0
	public void ShowNcInfoCurvePopup(NcCurveAnimation selObj, int nSelIndex, bool bSaveDialog)
	{
		if (SetFxmFolderPopup(typeof(FxmFolderPopup_NcInfoCurve)))
			(m_CurrentFolderPopup as FxmFolderPopup_NcInfoCurve).ShowPopupWindow(selObj, nSelIndex, bSaveDialog);
	}
Example #30
0
	public void ShowNcCurveAnimationPopup(NcCurveAnimation selObj, bool bSaveDialog)
	{
		if (SetFxmFolderPopup(typeof(FxmFolderPopup_NcCurveAnimation)))
			(m_CurrentFolderPopup as FxmFolderPopup_NcCurveAnimation).ShowPopupWindow(selObj, bSaveDialog);
	}
	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());
	}
Example #32
0
    private void InitAnimation()
    {
        if (this.m_Transform != null)
        {
            return;
        }
        this.m_fElapsedRate = 0f;
        this.m_Transform    = base.transform;
        foreach (NcCurveAnimation.NcInfoCurve current in this.m_CurveInfoList)
        {
            if (current.m_bEnabled)
            {
                switch (current.m_ApplyType)
                {
                case NcCurveAnimation.NcInfoCurve.APPLY_TYPE.POSITION:
                    current.m_OriginalValue = Vector4.zero;
                    current.m_BeforeValue   = current.m_OriginalValue;
                    break;

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

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

                case NcCurveAnimation.NcInfoCurve.APPLY_TYPE.MATERIAL_COLOR:
                    if (current.m_bRecursively)
                    {
                        if (this.m_ChildRenderers == null)
                        {
                            this.m_ChildRenderers  = base.transform.GetComponentsInChildren <Renderer>(true);
                            this.m_ChildColorNames = new string[this.m_ChildRenderers.Length];
                        }
                        current.m_ChildOriginalColorValues = new Vector4[this.m_ChildRenderers.Length];
                        current.m_ChildBeforeColorValues   = new Vector4[this.m_ChildRenderers.Length];
                        for (int i = 0; i < this.m_ChildRenderers.Length; i++)
                        {
                            Renderer renderer = this.m_ChildRenderers[i];
                            this.m_ChildColorNames[i] = NcCurveAnimation.Ng_GetMaterialColorName(renderer.sharedMaterial);
                            if (this.m_ChildColorNames[i] != null)
                            {
                                if (!this.m_bSavedOriginalValue)
                                {
                                    current.m_ChildOriginalColorValues[i] = renderer.material.GetColor(this.m_ChildColorNames[i]);
                                }
                                else
                                {
                                    renderer.material.SetColor(this.m_ChildColorNames[i], current.m_ChildOriginalColorValues[i]);
                                }
                            }
                            current.m_ChildBeforeColorValues[i] = Vector4.zero;
                        }
                    }
                    else if (base.renderer != null)
                    {
                        this.m_ColorName = NcCurveAnimation.Ng_GetMaterialColorName(base.renderer.sharedMaterial);
                        if (this.m_ColorName != null)
                        {
                            if (!this.m_bSavedOriginalValue)
                            {
                                current.m_OriginalValue = base.renderer.material.GetColor(this.m_ColorName);
                            }
                            else
                            {
                                base.renderer.material.SetColor(this.m_ColorName, current.m_OriginalValue);
                            }
                        }
                        current.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 != null)
                    {
                        if (!this.m_bSavedOriginalValue)
                        {
                            current.m_OriginalValue = new Vector4(this.m_NcUvAnimation.m_fScrollSpeedX, this.m_NcUvAnimation.m_fScrollSpeedY, 0f, 0f);
                        }
                        else
                        {
                            this.m_NcUvAnimation.m_fScrollSpeedX = current.m_OriginalValue.x;
                            this.m_NcUvAnimation.m_fScrollSpeedY = current.m_OriginalValue.y;
                        }
                    }
                    current.m_BeforeValue = current.m_OriginalValue;
                    break;

                case NcCurveAnimation.NcInfoCurve.APPLY_TYPE.MESH_COLOR:
                {
                    float t        = current.m_AniCurve.Evaluate(0f);
                    Color tarColor = Color.Lerp(current.m_FromColor, current.m_ToColor, t);
                    if (current.m_bRecursively)
                    {
                        this.m_ChildMeshFilters = base.transform.GetComponentsInChildren <MeshFilter>(true);
                        if (this.m_ChildMeshFilters != null && this.m_ChildMeshFilters.Length >= 0)
                        {
                            for (int j = 0; j < this.m_ChildMeshFilters.Length; j++)
                            {
                                this.ChangeMeshColor(this.m_ChildMeshFilters[j], tarColor);
                            }
                        }
                    }
                    else
                    {
                        this.m_MainMeshFilter = base.GetComponent <MeshFilter>();
                        this.ChangeMeshColor(this.m_MainMeshFilter, tarColor);
                    }
                    break;
                }
                }
            }
        }
        this.m_bSavedOriginalValue = true;
    }
Example #33
0
    // ---------------------------------------------------------------------
    public string EndCapture(Texture2D[] SpriteTextures)
    {
#if UNITY_WEBPLAYER
        Debug.LogError("In WEB_PLAYER mode, you cannot run the FXMaker.");
        Debug.Break();
        return(null);
#else
        int       nTexSize      = m_nResultTextureSize;
        int       nCapSize      = m_nResultCaptureSize;
        int       nMaxCount     = (nTexSize / nCapSize) * (nTexSize / nCapSize);
        int       nTexHeight    = (m_nSaveFrameCount <= nMaxCount / 2 ? nTexSize / 2 : nTexSize);
        Texture2D spriteTexture = new Texture2D(nTexSize, nTexHeight, TextureFormat.ARGB32, false);
        int       nSaveCount    = 0;

        for (int x = 0; x < spriteTexture.width; x++)
        {
            for (int y = 0; y < spriteTexture.height; y++)
            {
                spriteTexture.SetPixel(x, y, Color.black);
            }
        }

        for (int n = m_nSkipFrameCount; n < m_nTotalFrameCount; n++, nSaveCount++)
        {
            Color[] srcColors = SpriteTextures[n].GetPixels(0);

            if (m_ShaderType == SHADER_TYPE.ALPHA_BLENDED || m_ShaderType == SHADER_TYPE.ALPHA_BLENDED_MOBILE)
            {
                srcColors = NgAtlas.ConvertAlphaTexture(srcColors, true, FXMakerOption.inst.m_AlphaWeightCurve, 1, 1, 1);
            }
            spriteTexture.SetPixels(((nSaveCount) % (nTexSize / nCapSize)) * nCapSize, nTexHeight - (((nSaveCount) / (nTexSize / nCapSize) + 1) * nCapSize), nCapSize, nCapSize, srcColors);
            Object.DestroyImmediate(SpriteTextures[n]);
        }

        byte[] bytes = spriteTexture.EncodeToPNG();
        string texBasePath;
        if (FXMakerLayout.m_bDevelopState)
        {
            texBasePath = FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.SPRITE_TOOL);
        }
        else
        {
            texBasePath = FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.SPRITE_USER);
        }
        string pathTexture = NgTexture.UniqueTexturePath(texBasePath, m_SelectedPrefabName);

        // save texture
        File.WriteAllBytes(pathTexture, bytes);
        AssetDatabase.Refresh();
        NgTexture.ReimportTexture(pathTexture, m_bGUITexture, m_wrapMode, m_filterMode, m_anisoLevel, m_nSpriteTextureSizes[(int)m_fSpriteTextureIndex], m_SpriteTextureFormat[(int)m_fSpriteTextureFormatIdx]);
        Object.DestroyImmediate(spriteTexture);

        // Create Prefab
        if (m_bCreatePrefab)
        {
            string     pathMaterial = CreateMaterial(pathTexture);
            Material   newMat       = (Material)AssetDatabase.LoadAssetAtPath(pathMaterial, typeof(Material));
            GameObject newPrefab    = (GameObject)Instantiate(FXMakerMain.inst.m_FXMakerSpritePrefab);

            newPrefab.transform.rotation = Quaternion.identity;
            newPrefab.GetComponent <Renderer>().material = newMat;
            NcSpriteAnimation spriteCom = newPrefab.GetComponent <NcSpriteAnimation>();
            spriteCom.m_bBuildSpriteObj = true;
            spriteCom.m_nFrameCount     = m_nSaveFrameCount;
            spriteCom.m_fFps            = m_nResultFps;
            spriteCom.m_nTilingX        = m_nResultTextureSize / m_nResultCaptureSize;
            spriteCom.m_nTilingY        = (m_nSaveFrameCount <= spriteCom.m_nTilingX * spriteCom.m_nTilingX / 2 ? spriteCom.m_nTilingX / 2 : spriteCom.m_nTilingX);
            spriteCom.m_PlayMode        = m_PlayMode;
            spriteCom.m_bLoop           = m_bLoop;
            spriteCom.m_nLoopStartFrame = 0;
            spriteCom.m_nLoopFrameCount = spriteCom.m_nFrameCount;
            spriteCom.m_nLoopingCount   = 0;

            spriteCom.m_bAutoDestruct = !m_bLoop;

            NcCurveAnimation curveCom = newPrefab.GetComponent <NcCurveAnimation>();
            if (curveCom.GetCurveInfoCount() != 3)
            {
                Debug.LogError("FXMakerMain.inst.m_FxmSpritePrefab : curveCom Count Error!!!");
            }

            curveCom.GetCurveInfo(0).m_bEnabled = false;                        // both
            curveCom.GetCurveInfo(1).m_bEnabled = false;                        // fadein
            curveCom.GetCurveInfo(2).m_bEnabled = false;                        // fadeout
            curveCom.m_bAutoDestruct            = false;
            curveCom.m_fDurationTime            = spriteCom.GetDurationTime();

            if (m_bFadeIn && m_bFadeOut)
            {
                curveCom.GetCurveInfo(0).m_bEnabled = true;
            }
            else
            {
                if (m_bFadeIn)
                {
                    curveCom.GetCurveInfo(1).m_bEnabled = true;
                }
                if (m_bFadeOut)
                {
                    curveCom.GetCurveInfo(2).m_bEnabled = true;
                }
            }

            string     basePath     = AssetDatabase.GetAssetPath(FXMakerMain.inst.GetOriginalEffectPrefab());
            string     prefabPath   = UniquePrefabPath(NgFile.TrimFilenameExt(basePath));
            GameObject createPrefab = PrefabUtility.CreatePrefab(prefabPath, newPrefab);
            Destroy(newPrefab);

            // Create Thumb
            CreateSpriteThumb(createPrefab, pathTexture);

            AssetDatabase.SaveAssets();

            return(prefabPath);
        }
        else
        {
            return(pathTexture);
        }
#endif
    }
Example #34
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;
                }
            }
        }
    }
Example #35
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);
    }
	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;
		}
	}
	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 "";
	}
    // ==========================================================================================================
    void winPopup(int id)
    {
        Rect baseRect = GetPopupRect();
        Rect buttonRect;
        Rect lineRect;

        if (UnfocusClose(baseRect, -10, 0, 0, 0))
        {
            return;
        }

        baseRect = FXMakerLayout.GetChildVerticalRect(baseRect, 0, 1, 0, 1);

        Transform transOriginalRoot = FXMakerMain.inst.GetOriginalEffectObject().transform;
        int       nButtonCount      = m_nButtonCount * 2;
        int       nDrawCount        = 0;
        bool      bEnable           = false;

        // Copy
        if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("Copy"), true))
        {
            FXMakerClipboard.inst.SetClipboardObject(m_SelectedObject);
            ClosePopup(true);
            return;
        }
        nDrawCount += 2;

        // Cut
        switch (m_SelObjectType)
        {
        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_GAMEOBJECT:    bEnable = (m_SelectedTransform != transOriginalRoot);  break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_TRANSFORM:             bEnable = false;        break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_EASYEFFECT:    bEnable = true;         break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_UNITYENGINE:   bEnable = true;         break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_OTHER:                 bEnable = true;         break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_MATERIAL:              bEnable = false;        break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_ANICLIP:               bEnable = false;        break;

        default: Debug.LogWarning("not declare");      break;
        }
        if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("Cut"), bEnable))
        {
            FXMakerClipboard.inst.SetClipboardObject(m_SelectedObject);
            FXMakerHierarchy.inst.DeleteHierarchyObject(m_SelectedTransform, m_SelectedObject, m_nSelectedIndex);
            ClosePopup(true);
            return;
        }
        nDrawCount += 2;

        // Paste
        switch (m_SelObjectType)
        {
        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_GAMEOBJECT:
        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_TRANSFORM:
        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_EASYEFFECT:
        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_UNITYENGINE:
        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_OTHER:                 bEnable = FXMakerClipboard.inst.IsObject();     break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_MATERIAL:              bEnable = false;        break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_ANICLIP:               bEnable = false;        break;

        default: Debug.LogWarning("not declare");      break;
        }
        if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("Paste", FXMakerClipboard.inst.GetName()), bEnable))
        {
            Object tarObj = FXMakerClipboard.inst.PasteClipboardObject(m_SelectedTransform.gameObject, m_SelectedObject, m_nSelectedIndex);
            if (tarObj is GameObject)
            {
                SetAddObject((tarObj as GameObject), tarObj);
            }
            else
            {
                SetAddObject(null, tarObj);
            }
            ClosePopup(true);
            return;
        }
        nDrawCount += 2;

        // Overwrite
        switch (m_SelObjectType)
        {
        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_GAMEOBJECT:            bEnable = false;        break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_TRANSFORM:             bEnable = FXMakerClipboard.inst.IsTransform() && FXMakerClipboard.inst.GetObject().GetType() == m_SelectedObject.GetType();             break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_EASYEFFECT:
        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_UNITYENGINE:
        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_OTHER:                 bEnable = FXMakerClipboard.inst.IsComponent() && FXMakerClipboard.inst.GetObject().GetType() == m_SelectedObject.GetType();             break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_MATERIAL:              bEnable = FXMakerClipboard.inst.IsMaterial() && FXMakerClipboard.inst.GetObject().GetType() == m_SelectedObject.GetType();              break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_ANICLIP:               bEnable = FXMakerClipboard.inst.IsAnimationClip() && FXMakerClipboard.inst.GetObject().GetType() == m_SelectedObject.GetType(); break;

        default: Debug.LogWarning("not declare"); break;
        }
        if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("Overwrite", FXMakerClipboard.inst.GetName()), bEnable))
        {
            FXMakerClipboard.inst.OverwriteClipboardObject(m_SelectedTransform.gameObject, m_SelectedObject, m_nSelectedIndex);
            ClosePopup(true);
            return;
        }
        nDrawCount += 2;

        // Draw line
        lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 1);
        NgGUIDraw.DrawHorizontalLine(new Vector2(lineRect.x, lineRect.y + lineRect.height / 2), (int)lineRect.width, Color.gray, 2, false);
        nDrawCount += 1;

        // Duplicate
        switch (m_SelObjectType)
        {
        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_GAMEOBJECT:    bEnable = (m_SelectedTransform != transOriginalRoot);   break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_TRANSFORM:             bEnable = false;        break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_EASYEFFECT:    bEnable = true;         break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_UNITYENGINE:   bEnable = true;         break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_OTHER:                 bEnable = true;         break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_MATERIAL:              bEnable = false;        break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_ANICLIP:               bEnable = false;        break;

        default: Debug.LogWarning("not declare"); break;
        }
        if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("Duplicate"), bEnable))
        {
            switch (m_SelObjectType)
            {
            case FXMakerHierarchy.OBJECT_TYPE.OBJECT_GAMEOBJECT:    SetAddObject(FXMakerHierarchy.inst.AddGameObject(m_SelectedTransform.transform.parent.gameObject, m_SelectedTransform.gameObject), null);               break;

            case FXMakerHierarchy.OBJECT_TYPE.OBJECT_TRANSFORM:             break;

            case FXMakerHierarchy.OBJECT_TYPE.OBJECT_EASYEFFECT:
            case FXMakerHierarchy.OBJECT_TYPE.OBJECT_UNITYENGINE:
            case FXMakerHierarchy.OBJECT_TYPE.OBJECT_OTHER:                 m_AddComObject = NgSerialized.CloneComponent(m_SelectedObject as Component, (m_SelectedObject as Component).gameObject, false); break;

            case FXMakerHierarchy.OBJECT_TYPE.OBJECT_MATERIAL:              break;

            case FXMakerHierarchy.OBJECT_TYPE.OBJECT_ANICLIP:               break;

            default: Debug.LogWarning("not declare"); break;
            }
            ClosePopup(true);
            return;
        }
        nDrawCount += 2;

        // Disable
        if (m_SelObjectType == FXMakerHierarchy.OBJECT_TYPE.OBJECT_GAMEOBJECT)
        {
            bool bObjEnable = (m_SelectedTransform.gameObject.GetComponent <NcDontActive>() == null);
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), (bObjEnable ? GetHelpContent("Disable") : GetHelpContent("Enable")), (m_SelectedTransform != transOriginalRoot)))
            {
                FXMakerHierarchy.inst.SetEnableGameObject(m_SelectedTransform.gameObject, !bObjEnable);
                ClosePopup(true);
                return;
            }
        }
        else
        {
            buttonRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2);
            if (m_SelectedObject is Component)
            {
                int nObjEnable = EditorUtility.GetObjectEnabled(m_SelectedObject);
                if (0 <= nObjEnable)
                {
                    if (0 < nObjEnable)
                    {
                        if (GUI.Button(buttonRect, GetHelpContent("Disable")))
                        {
                            EditorUtility.SetObjectEnabled(m_SelectedObject, false);
                            ClosePopup(true);
                            return;
                        }
                    }
                    else
                    {
                        if (GUI.Button(buttonRect, GetHelpContent("Enable")))
                        {
                            EditorUtility.SetObjectEnabled(m_SelectedObject, true);
                            ClosePopup(true);
                            return;
                        }
                    }
                }
                else
                {
                    FXMakerLayout.GUIButton(buttonRect, GetHelpContent("Disable"), false);
                }
            }
            else
            {
                FXMakerLayout.GUIButton(buttonRect, GetHelpContent("Disable"), false);
            }
        }
        nDrawCount += 2;


        // Delete
        switch (m_SelObjectType)
        {
        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_GAMEOBJECT:    bEnable = (m_SelectedTransform != transOriginalRoot);  break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_TRANSFORM:             bEnable = false;        break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_EASYEFFECT:    bEnable = true;         break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_UNITYENGINE:   bEnable = true;         break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_OTHER:                 bEnable = true;         break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_MATERIAL:              bEnable = true;         break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_ANICLIP:               bEnable = true;         break;

        default: Debug.LogWarning("not declare"); break;
        }
        if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("Delete"), bEnable))
        {
            FXMakerHierarchy.inst.DeleteHierarchyObject(m_SelectedTransform, m_SelectedObject, m_nSelectedIndex);
            ClosePopup(true);
            return;
        }
        nDrawCount += 2;

        // Draw line
        lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 1);
        NgGUIDraw.DrawHorizontalLine(new Vector2(lineRect.x, lineRect.y + lineRect.height / 2), (int)lineRect.width, Color.gray, 2, false);
        nDrawCount += 1;

        // -------------------------------------------------------------------------------------
        if (m_SelectedObject is NcCurveAnimation)
        {
            // NcCurveAnimation
            NcCurveAnimation curveCom = m_SelectedObject as NcCurveAnimation;
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("SaveCurves"), 0 < curveCom.GetCurveInfoCount()))
            {
                ClosePopup(true);
                FxmPopupManager.inst.ShowNcCurveAnimationPopup(curveCom, true);
                return;
            }
            nDrawCount += 2;
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("LoadCurves"), true))
            {
                ClosePopup(true);
                FxmPopupManager.inst.ShowNcCurveAnimationPopup(curveCom, false);
                return;
            }
            nDrawCount += 2;
        }
        // -------------------------------------------------------------------------------------
        if (m_SelObjectType == FXMakerHierarchy.OBJECT_TYPE.OBJECT_GAMEOBJECT)
        {
            // Add Child
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("Add Child"), true))
            {
//              GameObject	newChild	= new GameObject("GameObject");
//              newChild.transform.parent = m_SelectedTransform;
//              FXMakerHierarchy.inst.OnAddGameObject(newChild);
//              SetAddObject(newChild, null);
//              ClosePopup(true);

                FXMakerHierarchy.inst.ShowAddObjectRightPopup();
                ClosePopup(false);

                return;
            }
            nDrawCount += 2;

            // Add Parent
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("Add Parent"), true))
            {
                GameObject newParent = new GameObject("GameObject");
                newParent.transform.parent = m_SelectedTransform.parent;
                m_SelectedTransform.parent = newParent.transform;
                m_SelectedTransform.name   = m_SelectedTransform.name.Replace("(Original)", "");
                if (m_SelectedTransform == transOriginalRoot)
                {
                    FXMakerMain.inst.ChangeRoot_OriginalEffectObject(newParent);
                }
                FXMakerHierarchy.inst.OnAddGameObject(newParent);
                SetAddObject(newParent, null);
                ClosePopup(true);
                return;
            }
            nDrawCount += 2;

            // MoveToParent
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("MoveToParent"), (m_SelectedTransform != transOriginalRoot && (m_SelectedTransform.parent != transOriginalRoot) || (m_SelectedTransform.parent == transOriginalRoot && transOriginalRoot.childCount == 1))))
            {
                if (m_SelectedTransform.parent == transOriginalRoot && transOriginalRoot.childCount == 1)
                {
                    FXMakerMain.inst.SaveTool("");
                    m_SelectedTransform = FXMakerMain.inst.GetOriginalEffectObject().transform;
                    // root swap
                    Transform toolRoot  = m_SelectedTransform.parent;
                    Transform newParent = m_SelectedTransform.GetChild(0);
                    Transform newChild  = m_SelectedTransform;
                    newChild.parent     = null;
                    newParent.parent    = null;
                    newChild.parent     = newParent;
                    newParent.parent    = toolRoot;
                    m_SelectedTransform = newParent;
                    FXMakerMain.inst.ChangeRoot_OriginalEffectObject(m_SelectedTransform.gameObject);
                    SetAddObject(null, null);
                }
                else
                {
                    m_SelectedTransform.parent = m_SelectedTransform.parent.parent;
                }
                ClosePopup(true);
                return;
            }
            nDrawCount += 2;

            // Add Component
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("Add Component"), true))
            {
                ClosePopup(true);
                FxmPopupManager.inst.ShowHierarchyObjectPopup("FxmPopup_GameObject", m_SelectedTransform.gameObject);
                return;
            }
            nDrawCount += 2;

            // Add Prefab
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("Add Prefab"), true))
            {
                FxmPopupManager.inst.ShowAddPrefabPopup(m_SelectedTransform);
                ClosePopup(true);
                return;
            }
            nDrawCount += 2;

            // Save Prefab
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("Save Prefab"), true))
            {
                ClosePopup(true);
                FxmPopupManager.inst.ShowSavePrefabPopup(m_SelectedTransform);
                return;
            }
            nDrawCount += 2;
        }
        // -------------------------------------------------------------------------------------
        if (m_SelObjectType == FXMakerHierarchy.OBJECT_TYPE.OBJECT_MATERIAL)
        {
            bEnable = NgMaterial.IsMaterialColor(m_SelectedObject as Material);

            // Copy Color
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("Copy Color"), bEnable))
            {
                FXMakerClipboard.inst.SetClipboardColor(NgMaterial.GetMaterialColor(m_SelectedObject as Material));
                ClosePopup(true);
                return;
            }
            if (bEnable)
            {
                Rect colorRect = FXMakerLayout.GetOffsetRect(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), -5);
                colorRect.width = colorRect.height;
                EditorGUIUtility.DrawColorSwatch(colorRect, NgMaterial.GetMaterialColor(m_SelectedObject as Material));
            }
            nDrawCount += 2;

            // Paste Color
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("Paste Color"), bEnable))
            {
                FXMakerClipboard.inst.PasteClipboardColor(m_SelectedTransform, m_nSelectedIndex, m_SelectedObject as Material);
                ClosePopup(true);
                return;
            }
            {
                Rect colorRect = FXMakerLayout.GetOffsetRect(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), -5);
                colorRect.width = colorRect.height;
                EditorGUIUtility.DrawColorSwatch(colorRect, FXMakerClipboard.inst.m_CopyColor);
            }
            nDrawCount += 2;
        }

        m_nButtonCount = nDrawCount / 2;
        FXMakerMain.inst.SaveTooltip();
    }
Example #39
0
    public void play()
    {
        for (int i = 0; i < eod.particleSystemList.Count; i++)
        {
            ParticleSystem ps = eod.particleSystemList[i];
            if (ps != null)
            {
                ps.Play(true);
            }
        }
        //foreach (SpriteAnimation sa in spriteAnimationList)
        //{
        //    sa.delayIng = true;
        //    sa.loop = false;
        //    sa.enabled = true;
        //    sa.isPaused = false;
        //}
        float time = 5000f - (Time.time - oldTime);

        for (int i = 0; i < eod.ncCurveAnimationList.Count; i++)
        {
            NcCurveAnimation nc = eod.ncCurveAnimationList[i];
            if (nc.isDelay())
            {
                nc.m_fDelayTime -= time;
            }
            else
            {
                nc.ResumeAnimation();
            }
        }
        for (int i = 0; i < eod.ncSpriteAnimationList.Count; i++)
        {
            NcSpriteAnimation nc = eod.ncSpriteAnimationList[i];
            if (nc.isDelay())
            {
                nc.m_fDelayTime -= time;
            }
            else
            {
                nc.ResumeAnimation();
            }
        }
        for (int i = 0; i < eod.ncUvAnimationList.Count; i++)
        {
            NcUvAnimation nc = eod.ncUvAnimationList[i];
            nc.ResumeAnimation();
        }
        for (int i = 0; i < eod.ncRotationList.Count; i++)
        {
            NcRotation nc = eod.ncRotationList[i];
            nc.ResumeAnimation();
        }
        for (int i = 0; i < eod.animatorList.Count; i++)
        {
            Animator animator = eod.animatorList[i];
            animator.speed = 1;
        }
        for (int i = 0; i < eod.animationList.Count; i++)
        {
            Animation animation = eod.animationList[i];
            animation.Play();
        }
    }
 void Start()
 {
     m_fStartTime = GetEngineTime();
     if (m_bEndNcCurveAnimation)
         m_NcCurveAnimation = GetComponent<NcCurveAnimation>();
 }
 // Property -------------------------------------------------------------------------
 // Event Function -------------------------------------------------------------------
 void OnEnable()
 {
     m_Sel         = target as NcCurveAnimation;
     m_UndoManager = new FXMakerUndoManager(m_Sel, "NcCurveAnimation");
 }
Example #42
0
 private void Awake()
 {
     this.m_bEndNcCurveAnimation = false;
     this.m_fStartTime           = 0f;
     this.m_NcCurveAnimation     = null;
 }