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


C# ILuaState.ToUserData方法代码示例

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


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

示例1: addEffectToBuff

 public static int addEffectToBuff(ILuaState luaState)
 {
     SkillEffect effect = (SkillEffect)luaState.ToUserData(-2);
     BuffDataDriven buff = (BuffDataDriven)luaState.ToUserData(-1);
     buff.addEffect(effect);
     return 0;
 }
开发者ID:LostTemple1990,项目名称:TouHouExploding,代码行数:7,代码来源:EffectLib.cs

示例2: applyDamage

 public static int applyDamage(ILuaState luaState)
 {
     if (luaState.IsTable(-1))
     {
         DamageResult dmgRes = new DamageResult();
         // 攻击者
         luaState.GetField(-1, "attacker");
         dmgRes.attacker = (Unit)luaState.ToUserData(-1);
         luaState.Pop(1);
         // 受害者
         luaState.GetField(-1, "victim");
         dmgRes.victim = (Unit)luaState.ToUserData(-1);
         luaState.Pop(1);
         // 伤害
         luaState.GetField(-1, "physicalDamage");
         dmgRes.physicalDamage = luaState.ToInteger(-1);
         luaState.Pop(1);
         luaState.GetField(-1, "spellDamage");
         dmgRes.spellDamage = luaState.ToInteger(-1);
         luaState.Pop(1);
         luaState.GetField(-1, "hpRemoval");
         dmgRes.hpRemoval = luaState.ToInteger(-1);
         luaState.Pop(1);
         // 伤害原因
         luaState.GetField(-1, "damageReason");
         dmgRes.damageReason = (BattleConsts.DamageReason)luaState.ToInteger(-1);
         luaState.Pop(1);
         ProcessManager.getInstance().addResult(dmgRes);
     }
     return 0;
 }
开发者ID:LostTemple1990,项目名称:TouHouExploding,代码行数:31,代码来源:EffectLib.cs

示例3: addBuffToUnit

 public static int addBuffToUnit(ILuaState luaState)
 {
     BuffDataDriven buff = (BuffDataDriven)luaState.ToUserData(-2);
     Unit unit = (Unit)luaState.ToUserData(-1);
     unit.addBuff(buff);
     return 0;
 }
开发者ID:LostTemple1990,项目名称:TouHouExploding,代码行数:7,代码来源:EffectLib.cs

示例4: FFI_CallMethod

 private static int FFI_CallMethod( ILuaState lua )
 {
     var ffiMethod = (FFIMethodBase)lua.ToUserData(1);
     if (ffiMethod != null)
     {
         try
         {
             return ffiMethod.Call(lua);
         }
         catch( Exception e )
         {
             lua.PushString( "call_method Exception: " + e.Message +
                 "\nSource:\n" + e.Source +
                 "\nStaceTrace:\n" + e.StackTrace );
             lua.Error();
             return 0;
         }
     }
     else
     {
         lua.PushString( "call_method cannot find MethodInfo" );
         lua.Error();
         return 0;
     }
 }
开发者ID:matthewyang,项目名称:UniLua,代码行数:25,代码来源:LuaFFILib.cs

示例5: applyTranslate

 public static int applyTranslate(ILuaState luaState)
 {
     if (luaState.IsTable(-1))
     {
         TranslateResult transRes = new TranslateResult();
         // 位移目标
         luaState.GetField(-1, "target");
         transRes.target = (Unit)luaState.ToUserData(-1);
         luaState.Pop(1);
         // 行偏移量
         luaState.GetField(-1, "offsetRow");
         transRes.offsetRow = luaState.ToInteger(-1);
         luaState.Pop(1);
         // 列偏移量
         luaState.GetField(-1, "offsetCol");
         transRes.offsetCol = luaState.ToInteger(-1);
         luaState.Pop(1);
         //// 位移原因
         //luaState.GetField(-1, "translateReason");
         //transRes. = luaState.ToInteger(-1);
         //luaState.Pop(1);
         ProcessManager.getInstance().addResult(transRes);
     }
     return 0;
 }
开发者ID:LostTemple1990,项目名称:TouHouExploding,代码行数:25,代码来源:EffectLib.cs

示例6: getEffectTarget

 public static int getEffectTarget(ILuaState luaState)
 {
     SkillEffect effect = (SkillEffect)luaState.ToUserData(-1);
     if (effect == null)
     {
         throw new ArgumentException("effect is null!");
     }
     luaState.PushInteger(effect.getTarget());
     return 1;
 }
开发者ID:LostTemple1990,项目名称:TouHouExploding,代码行数:10,代码来源:PropertyLib.cs

示例7: getEventVO

 public static int getEventVO(ILuaState luaState)
 {
     BattleEventBase evt = (BattleEventBase)luaState.ToUserData(-1);
     if ( evt == null )
     {
         luaState.PushNil();
     }
     else
     {
         luaState.PushLightUserData(evt.getEventVO());
     }
     return 1;
 }
开发者ID:LostTemple1990,项目名称:TouHouExploding,代码行数:13,代码来源:PropertyLib.cs

示例8: getEventVOProperty

 public static int getEventVOProperty(ILuaState luaState)
 {
     BattleEventBase evt = (BattleEventBase)luaState.ToUserData(-2);
     if (evt == null)
     {
         luaState.PushNil();
     }
     else
     {
         BattleConsts.Property propId = (BattleConsts.Property)luaState.ToInteger(-1);
         object prop = evt.getEventVOProperty(propId);
         if ( prop == null )
         {
             luaState.PushNil();
         }
         else
         {
             luaState.PushLightUserData(prop);
         }
     }
     return 1;
 }
开发者ID:LostTemple1990,项目名称:TouHouExploding,代码行数:22,代码来源:PropertyLib.cs

示例9: FFI_GetField

 private static int FFI_GetField( ILuaState lua )
 {
     var t = (Type)lua.ToUserData(1);
     var name = lua.ToString(2);
     var finfo = t.GetField( name,
         BindingFlags.Instance |
         BindingFlags.Public );
     if( finfo == null )
         throw new Exception("GetField failed:"+name);
     // UnityEngine.Debug.Log("FFI_GetField t:"+t+" name:"+name+" finfo:"+finfo);
     lua.PushLightUserData(finfo);
     return 1;
 }
开发者ID:matthewyang,项目名称:UniLua,代码行数:13,代码来源:LuaFFILib.cs

示例10: FFI_GetConstructor

        private static int FFI_GetConstructor( ILuaState lua )
        {
            var t = (Type)lua.ToUserData(1);
            var n = lua.RawLen(2);
            var types = new Type[n];
            for( int i=0; i<n; ++i )
            {
                lua.RawGetI( 2, i+1 );
                types[i] = (Type)lua.ToUserData(-1);
                lua.Pop( 1 );
            }

            var cinfo = t.GetConstructor( types );
            var ffiMethod = new FFIConstructorInfo(cinfo);
            lua.PushLightUserData( ffiMethod );
            return 1;
        }
开发者ID:matthewyang,项目名称:UniLua,代码行数:17,代码来源:LuaFFILib.cs

示例11: FFI_SetFieldValue

		private static int FFI_SetFieldValue( ILuaState lua )
		{
			var finfo = (FieldInfo)lua.ToUserData(1);
			var inst = lua.ToUserData(2);
			var t = (Type)lua.ToUserData(4);
			var value = LuaStackUtil.ToRawValue(lua, 3, t);
			finfo.SetValue( inst, value );
			return 0;
		}
开发者ID:Jornason,项目名称:UniLua,代码行数:9,代码来源:LuaFFILib.cs

示例12: GetMethodAux

 private static int GetMethodAux( ILuaState lua, BindingFlags flags )
 {
     var t = (Type)lua.ToUserData(1);
     var mname = lua.ToString(2);
     var n = lua.RawLen(3);
     var types = new Type[n];
     for( int i=0; i<n; ++i )
     {
         lua.RawGetI( 3, i+1 );
         types[i] = (Type)lua.ToUserData(-1);
         lua.Pop(1);
     }
     var minfo = t.GetMethod( mname,
         flags,
         null,
         CallingConventions.Any,
         types,
         null
         );
     if( minfo == null )
     {
         return 0;
     }
     else
     {
         var ffiMethod = new FFIMethodInfo(minfo);
         lua.PushLightUserData( ffiMethod );
         return 1;
     }
 }
开发者ID:matthewyang,项目名称:UniLua,代码行数:30,代码来源:LuaFFILib.cs

示例13: FFI_GetProp

		private static int FFI_GetProp( ILuaState lua )
		{
			var t = (Type)lua.ToUserData(1);
			var name = lua.ToString(2);
			var pinfo = t.GetProperty( name,
				BindingFlags.Instance |
				BindingFlags.Public );
			if( pinfo == null )
				throw new Exception("GetProperty failed:"+name);
			lua.PushLightUserData(pinfo);
			return 1;
		}
开发者ID:Jornason,项目名称:UniLua,代码行数:12,代码来源:LuaFFILib.cs

示例14: FFI_GetStaticProp

 private static int FFI_GetStaticProp( ILuaState lua )
 {
     var t = (Type)lua.ToUserData(1);
     var name = lua.ToString(2);
     var pinfo = t.GetProperty( name,
         BindingFlags.Static |
         BindingFlags.Public );
     // UnityEngine.Debug.Log("FFI_GetStaticProp t:"+t+" name:"+name+" pinfo:"+pinfo);
     if( pinfo == null )
         throw new Exception("GetProperty failed:"+name);
     lua.PushLightUserData(pinfo);
     return 1;
 }
开发者ID:matthewyang,项目名称:UniLua,代码行数:13,代码来源:LuaFFILib.cs

示例15: FFI_GetFieldValue

 private static int FFI_GetFieldValue( ILuaState lua )
 {
     var finfo = (FieldInfo)lua.ToUserData(1);
     var inst = lua.ToUserData(2);
     var returnType = (Type)lua.ToUserData(3);
     var value = finfo.GetValue( inst );
     LuaStackUtil.PushRawValue( lua, value, returnType );
     return 1;
 }
开发者ID:matthewyang,项目名称:UniLua,代码行数:9,代码来源:LuaFFILib.cs


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