コード例 #1
0
ファイル: LuaGameCamera.cs プロジェクト: cedar-x/unilua_story
        private void oncomplete(LuaObjWithCallFun callBackFun)
        {
            //print("luaGameCamera:oncomplete:................."+callBackFun);
            EventDelegate.Execute(onTweenStop);
			ml_paramTab.Clear();
            if (m_callBackFun.dwConpleteFun == 0) return;
            ILuaState lua = Game.LuaApi;
            lua.RawGetI(LuaDef.LUA_REGISTRYINDEX, m_callBackFun.dwConpleteFun);

            if (lua.PCall(0, 0, 0) != 0)
            {
                Debug.LogWarning(lua.ToString(-1));
                lua.Pop(1);
            }

            //lua.L_Unref(LuaDef.LUA_REGISTRYINDEX, callBackFun.dwStartFun);
            //m_callBackFun.dwConpleteFun = 0;
        }
コード例 #2
0
ファイル: LuaGameCamera.cs プロジェクト: cedar-x/unilua_story
        /// //////////////////////////////////////////////////////
        private void onstart(LuaObjWithCallFun callBackFun)
        {
            //print("luaGameCamera:onstart.................");
            if (m_callBackFun.dwStartFun == 0) return;
            ILuaState lua = Game.LuaApi;
            lua.RawGetI(LuaDef.LUA_REGISTRYINDEX, m_callBackFun.dwStartFun);

            if (lua.PCall(0, 0, 0) != 0)
            {
                Debug.LogWarning(lua.ToString(-1));
                lua.Pop(1);
            }

            lua.L_Unref(LuaDef.LUA_REGISTRYINDEX, callBackFun.dwStartFun);
        }
コード例 #3
0
ファイル: LuaGameCamera.cs プロジェクト: cedar-x/unilua_story
 private void onupdate(LuaObjWithCallFun callBackFun)
 {
     
 }
コード例 #4
0
ファイル: LuaItween.cs プロジェクト: cedar-x/unilua_story
        // zsy add
        private Hashtable MoveControllerAdaptHasHTable(ILuaState lua)
        {
            LuaObjWithCallFun callBackFun = new LuaObjWithCallFun();
            //print("*********** state len" + lua.GetTop());
            Hashtable hashTable = new Hashtable();
            lua.PushValue(3);
            lua.PushNil();
            while (lua.Next(-2))
            {
                string key = lua.L_CheckString(-2);
                switch (key)
                {
                    case "animation":
                        {
                            Hashtable animation = new Hashtable();
                            lua.PushValue(-1);
                            lua.PushNil();

                            float value = 0;
                            string strtype = "ease";
                            bool blean = true;

                            while (lua.Next(-2))
                            {
                                string childkey = lua.L_CheckString(-2);
                                switch (childkey)
                                {
                                    case "onstart":
                                        {
                                            if (lua.Type(-1) == LuaType.LUA_TFUNCTION)
                                            {
                                                lua.PushValue(-1);
                                                callBackFun.dwStartFun = lua.L_Ref(LuaDef.LUA_REGISTRYINDEX);
                                                animation.Add(childkey, childkey);
                                            }
                                            break;
                                        }
                                    case "onupdate":
                                        {
                                            if (lua.Type(-1) == LuaType.LUA_TFUNCTION)
                                            {
                                                lua.PushValue(-1);
                                                callBackFun.dwUpdateFun = lua.L_Ref(LuaDef.LUA_REGISTRYINDEX);

                                                animation.Add(childkey, childkey);
                                            }
                                            break;
                                        }
                                    case "oncomplete":
                                        {
                                            if (lua.Type(-1) == LuaType.LUA_TFUNCTION)
                                            {
                                                lua.PushValue(-1);
                                                callBackFun.dwConpleteFun = lua.L_Ref(LuaDef.LUA_REGISTRYINDEX);

                                                animation.Add(childkey, childkey);
                                            }
                                            break;
                                        }

                                    default:
                                        switch (lua.Type(-1))
                                        {
                                            case LuaType.LUA_TNUMBER:
                                                value = (float)lua.L_CheckNumber(-1);
                                                animation.Add(childkey, value);
                                                break;
                                            case LuaType.LUA_TBOOLEAN:
                                                blean = lua.ToBoolean(-1);
                                                animation.Add(childkey, blean);
                                                break;
                                            case LuaType.LUA_TSTRING:
                                                strtype = lua.L_CheckString(-1);
                                                animation.Add(childkey, strtype);
                                                break;
                                            default:
                                                break;
                                        }
                                        break;
                                }
                                
                                lua.Pop(1);
                            }
                            lua.Pop(1);

                            if (callBackFun.dwConpleteFun != 0)
                            {
                                animation.Add("oncompleteparams", callBackFun);
                            }
                            if (callBackFun.dwStartFun != 0)
                            {
                                animation.Add("onstartparams", callBackFun);
                            }
                            if (callBackFun.dwUpdateFun != 0)
                            {
                                animation.Add("onupdateparams", callBackFun);
                            }

                            animation.Add("onstarttarget", gameObject);
                            animation.Add("onupdatetarget", gameObject);
                            animation.Add("oncompletetarget", gameObject); 

                            hashTable.Add(key, animation);
                            break;
                        }
                    case "keyframes":
                        {
                            Hashtable keyframes = new Hashtable();
                            lua.PushValue(-1);
                            lua.PushNil();

                            int numkey = -1;
                            string strkey = "from";

                            while (lua.Next(-2))
                            {
                                Hashtable tempHash = new Hashtable();
                                if (lua.Type(-1) == LuaType.LUA_TTABLE)
                                {
                                    lua.PushValue(-1);
                                    lua.PushNil();
                                    while (lua.Next(-2))
                                    {
                                        string child2key = lua.L_CheckString(-2);
                                        switch (child2key)
                                        {
                                            case "pos":
                                            case "scale":
                                            case "rotate":
                                            case "color":
                                                Vector3 vecValue = GetVector3(lua, -1);
                                                tempHash.Add(child2key, vecValue);
                                                break;                                                
                                            case "alpha":
                                                float alpha = (float)lua.L_CheckNumber(-1);
                                                tempHash.Add(child2key, alpha);
                                                break;
                                            default:
                                                break;
                                        }
                                        lua.Pop(1);
                                    }
                                    lua.Pop(1);
                                }
                                if (lua.Type(-2) == LuaType.LUA_TSTRING)
                                {
                                    strkey = lua.L_CheckString(-2);
                                    keyframes.Add(strkey, tempHash);
                                }
                                else if (lua.Type(-2) == LuaType.LUA_TNUMBER)
                                {
                                    numkey = (int)lua.L_CheckInteger(-2);
                                    keyframes.Add(numkey, tempHash);
                                }
                                lua.Pop(1);
                            }
                            lua.Pop(1);

                            hashTable.Add(key, keyframes);
                            break;
                        }
                    default:
                        break;

                }
                lua.Pop(1);
            }
            lua.Pop(1);
            //print("***********AAAAAAA state len" + lua.GetTop());
            return hashTable;
        }
コード例 #5
0
ファイル: LuaItween.cs プロジェクト: cedar-x/unilua_story
		private void oncomplete(LuaObjWithCallFun callBackFun)
		{
			ILuaState lua = Game.LuaApi;
			lua.RawGetI(LuaDef.LUA_REGISTRYINDEX,callBackFun.dwConpleteFun);

			if(lua.PCall(0,0,0) != 0)
			{
				Debug.LogWarning(lua.ToString(-1));
				lua.Pop(1);
			}
			lua.L_Unref(LuaDef.LUA_REGISTRYINDEX,callBackFun.dwConpleteFun);
			if (callBackFun.dwUpdateFun != 0) {
				lua.L_Unref(LuaDef.LUA_REGISTRYINDEX,callBackFun.dwUpdateFun);
			}
			callBackFun = null;
		}
コード例 #6
0
ファイル: LuaItween.cs プロジェクト: cedar-x/unilua_story
		private void onupdate(LuaObjWithCallFun callBackFun)
		{
			ILuaState lua = Game.LuaApi;
			lua.RawGetI(LuaDef.LUA_REGISTRYINDEX,callBackFun.dwUpdateFun);
			
			if(lua.PCall(0,0,0) != 0)
			{
				Debug.LogWarning(lua.ToString(-1));
				lua.Pop(1);
			}

		}
コード例 #7
0
ファイル: LuaItween.cs プロジェクト: cedar-x/unilua_story
		private Hashtable ItweenAdaptHasHTable(ILuaState lua)
		{
			LuaObjWithCallFun callBackFun = new LuaObjWithCallFun ();

            lua.PushValue(3);
		    Hashtable hashTable = ItweenParamHasHTable(lua, callBackFun);

			if (callBackFun.dwConpleteFun != 0) {
				hashTable.Add("oncompleteparams",callBackFun);
			}
			if (callBackFun.dwStartFun != 0) {
				hashTable.Add("onstartparams",callBackFun);
			}
			if (callBackFun.dwUpdateFun != 0) {
				hashTable.Add("onupdateparams",callBackFun);
			}	
			
			hashTable.Add ("onstarttarget", gameObject);
			hashTable.Add ("onupdatetarget", gameObject);
			hashTable.Add ("oncompletetarget", gameObject); 

			return hashTable;
		}
コード例 #8
0
ファイル: LuaItween.cs プロジェクト: cedar-x/unilua_story
        static public Hashtable ItweenParamHasHTable(ILuaState lua, LuaObjWithCallFun callBackFun)
        {
            Hashtable hashTable = new Hashtable();
			lua.PushNil ();
			while (lua.Next(-2)) {
				string key = lua.L_CheckString(-2);
				switch(key)
				{
				case "path":
				{
					Vector3[] path = GetPath(lua,-1);
					hashTable.Add(key,path);
					break;
				}
				case "rotation":
				case "position":
				case "looktarget":
				//case "amount":
				case "scale":
				{
					Vector3  transfrom = GetVector3(lua,-1);
					hashTable.Add(key,transfrom);
					break;
				}
				case "movetopath":
				case "islocal":
				{		
					bool bIsLocal = false;
					if( lua.Type(-1) == LuaType.LUA_TBOOLEAN){
						 bIsLocal = lua.ToBoolean(-1);
					}
					hashTable.Add(key,bIsLocal);
					break;
				}
				case "easetype":
				{
					iTween.EaseType value = (iTween.EaseType)lua.L_CheckInteger(-1);
					hashTable.Add(key,value);
					break;
				}
				case "LoopType":
				{
					iTween.LoopType value = (iTween.LoopType)lua.L_CheckInteger(-1);
					hashTable.Add(key,value);
					break;
				}
				case "onstart":
				{
					if(lua.Type(-1) == LuaType.LUA_TFUNCTION)
					{
						lua.PushValue(-1);
						callBackFun.dwStartFun = lua.L_Ref(LuaDef.LUA_REGISTRYINDEX);
						string value = key;
						hashTable.Add(key,value);
					}
					break;
				}
				case "onupdate":
				{
					if(lua.Type(-1) == LuaType.LUA_TFUNCTION)
					{
						lua.PushValue(-1);
						callBackFun.dwUpdateFun = lua.L_Ref(LuaDef.LUA_REGISTRYINDEX);
						string value = key;
						hashTable.Add(key,value);
					}
					break;
				}
				case "oncomplete":
				{
					if(lua.Type(-1) == LuaType.LUA_TFUNCTION)
					{
						lua.PushValue(-1);
						callBackFun.dwConpleteFun = lua.L_Ref(LuaDef.LUA_REGISTRYINDEX);
						string value = key;
						hashTable.Add(key,value);
					}
					break;
				}
				case "onstarttarget":
				case "onupdatetarget":
				case "oncompletetarget":
                {
					break;
				}

				
				default:
				{
					float value = (float)lua.L_CheckNumber(-1);
					hashTable.Add(key,value);
					break;
				}
					
				}
				lua.Pop(1);
			}
			lua.Pop(1);
            return hashTable;
        }