当前位置: 首页>>代码示例>>C#>>正文


C# ILuaState.L_Ref方法代码示例

本文整理汇总了C#中ILuaState.L_Ref方法的典型用法代码示例。如果您正苦于以下问题:C# ILuaState.L_Ref方法的具体用法?C# ILuaState.L_Ref怎么用?C# ILuaState.L_Ref使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ILuaState的用法示例。


在下文中一共展示了ILuaState.L_Ref方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WidgetWriteOper

        protected override bool WidgetWriteOper(ILuaState lua, string key)
        {
            switch (key)
            {
                case "onFinish":
                    {
                        //lua.L_UnrefRegistry(ref m_pfnFinish);

                        if (lua.Type(3) != LuaType.LUA_TFUNCTION)
                        {
                            return true;
                        }

                        lua.PushValue(3);
                        m_pfnFinish = lua.L_Ref(LuaDef.LUA_REGISTRYINDEX);
                    }
                    return true;
                case "bDestroyOnFinish":
                    m_bDestroyOnFinish = lua.ToBoolean(3);
                    return true;
                case "finishTime":
                    m_fEffectTime = (float)lua.ToNumber(3);
                    return true;
            }
            return base.WidgetWriteOper(lua, key);
        }
开发者ID:cedar-x,项目名称:unilua_story,代码行数:26,代码来源:LuaEffect.cs

示例2: storeMethod

 private int storeMethod(ILuaState luaState, string name)
 {
     luaState.GetField(-1, "cost");
     if (luaState.IsFunction(-1))
     {
         return luaState.L_Ref(LuaDef.LUA_REGISTRYINDEX);
     }
     return 0;
 }
开发者ID:LostTemple1990,项目名称:TouHouExploding,代码行数:9,代码来源:SkillDataDriven.cs

示例3: setEffectTarget

 public static int setEffectTarget(ILuaState luaState)
 {
     SkillEffect effect = (SkillEffect)luaState.ToUserData(-2);
     if (effect == null)
     {
         throw new ArgumentException("effect is null!");
     }
     int target = 0;
     if ( !luaState.IsFunction(-1) )
     {
         throw new ArgumentException("effect target is not a function!");
     }
     target = luaState.L_Ref(LuaDef.LUA_REGISTRYINDEX);
     effect.setTarget(target);
     return 0;
 }
开发者ID:LostTemple1990,项目名称:TouHouExploding,代码行数:16,代码来源:PropertyLib.cs

示例4: MoveControllerAdaptHasHTable

        // 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);
//.........这里部分代码省略.........
开发者ID:cedar-x,项目名称:unilua_story,代码行数:101,代码来源:LuaItween.cs

示例5: ItweenParamHasHTable

        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;
        }
开发者ID:cedar-x,项目名称:unilua_story,代码行数:100,代码来源:LuaItween.cs


注:本文中的ILuaState.L_Ref方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。