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


C# ILuaState.ToBoolean方法代码示例

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


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

 protected override bool WidgetWriteOper(ILuaState lua, string key)
 {
     switch (key)
     {
         case "bRecalculate":
             bRecalculate = lua.ToBoolean(-1);;
             break;
         default:
             return base.WidgetWriteOper(lua, key);
     }
     return true;
 }
开发者ID:cedar-x,项目名称:unilua_story,代码行数:12,代码来源:StoryCombineCtrl.cs

示例3: testLuaCall

 public static int testLuaCall(ILuaState luaState)
 {
     bool arg2 = luaState.ToBoolean(-1);
     luaState.GetField(1, "n");
     int len = luaState.ToInteger(-1);
     luaState.Pop(1);
     int sum = 0;
     for (int i=0;i<len;i++)
     {
         luaState.PushInteger(i + 1);
         luaState.GetTable(1);
         sum += luaState.ToInteger(-1);
         luaState.Pop(1);
     }
     Thread.Sleep(5000);
     luaState.PushInteger(sum);
     Debug.Log(sum);
     return 1;
 }
开发者ID:LostTemple1990,项目名称:TouHouExploding,代码行数:19,代码来源:TestLuaLib.cs

示例4: GetValue

        public static dynamic GetValue(this LuaType self, ILuaState luaState, int index)
        {
            switch (self)
            {
            case LuaType.Boolean:
                return luaState.ToBoolean(index);

            case LuaType.Number:
                return luaState.ToNumber(index);

            case LuaType.String:
                return luaState.ToString(index);

            case LuaType.Table:
                return new LuaTable(luaState, index);

            case LuaType.Nil:
                return null;

            default:
                throw new NotImplementedException(string.Format("Try get {0} of type {1}", index, self));
            }
        }
开发者ID:xinhuang,项目名称:dotLua,代码行数:23,代码来源:LuaType.cs

示例5: WidgetWriteOper

 protected virtual bool WidgetWriteOper(ILuaState lua, string key)
 {
     int dwStackIndex = lua.GetTop();
     switch (key)
     {
         case "event":
             break;
         case "time":
             time = (float)lua.L_CheckNumber(-1);
             break;
         case "bWait":
             bWait = lua.ToBoolean(-1);
             break;
         case "bClick":
             bClick = lua.ToBoolean(-1);
             break;
         default:
             return false;
     }
     if (dwStackIndex != lua.GetTop())
         Debug.LogWarning("StoryBaseCtrl:WidgetWriteOper stack Exception:start=" + key + ":" + dwStackIndex + " end=" + lua.GetTop());
     return true;
 }
开发者ID:cedar-x,项目名称:unilua_story,代码行数:23,代码来源:StoryBaseCtrl.cs

示例6: Lua_PlayEffect

        int Lua_PlayEffect(ILuaState lua)
        {
            string effect = lua.ToString(2);
            float fDelay = (float)lua.ToNumber(3);
            bool bWorldPos = lua.ToBoolean(4);
            float fExistTime = (float)lua.ToNumber(5);
            int dwEffectType = (int)EffectType.Once;

            if(lua.Type(6) == LuaType.LUA_TNUMBER)
            {
                dwEffectType = lua.ToInteger(6);
            }
            this.PlayEffect(effect, fDelay,bWorldPos,fExistTime,(EffectType)dwEffectType);
            return 0;
        }
开发者ID:cedar-x,项目名称:unilua_story,代码行数:15,代码来源:Entity.cs

示例7: SortComp

		private static bool SortComp( ILuaState lua, int a, int b )
		{
			if( !lua.IsNil(2) ) // function?
			{
				lua.PushValue( 2 );
				lua.PushValue( a-1 ); // -1 to compensate function
				lua.PushValue( b-2 ); // -2 to compensate function add `a'
				lua.Call( 2, 1 );
				bool res = lua.ToBoolean( -1 );
				lua.Pop( 1 );
				return res;
			}
			else /// a < b?
				return lua.Compare( a, b, LuaEq.LUA_OPLT );
		}
开发者ID:jaydenh,项目名称:UniLua,代码行数:15,代码来源:LuaTableLib.cs

示例8: Lua_CreateAudio

 private static int Lua_CreateAudio(ILuaState lua)
 {
     string strName = lua.L_CheckString(2);
     bool bLoop = false;
     if (lua.Type(3) == LuaType.LUA_TBOOLEAN)
     {
         bLoop = lua.ToBoolean(3);
     }
     AudioObject obj = CreateAudio(strName, bLoop);
     if (obj)
     {
         obj.PushThis(lua);
         return 1;
     }
     return 0;
 }
开发者ID:cedar-x,项目名称:unilua_story,代码行数:16,代码来源:AudioManager.cs

示例9: WidgetWriteOper

        protected override bool WidgetWriteOper(ILuaState lua, string key)
        {
            switch (key)
            {
                case "visible":
                    Visible = lua.ToBoolean(3);
                    return true;
                case "direction":
                    SetDirection((float)lua.L_CheckNumber(3));
                    return true;
                case "type":
                    SetEntityType((EntityType)lua.L_CheckInteger(3));
                    return true;
                case "scale":
                    SetLocalScale((float)lua.L_CheckNumber(3));
                    return true;
                case "highlightcolor":
                    if (lua.Type(3) != LuaType.LUA_TTABLE)
                    {
                        Debug.LogWarning("Entity hightlightcolor attribute parm table excepted.");
                        return true;
                    }

                    lua.GetField(3, "r");
                    _highlightColor.r = (float)lua.L_CheckNumber(-1);
                    lua.Pop(1);

                    lua.GetField(3, "g");
                    _highlightColor.g = (float)lua.L_CheckNumber(-1);
                    lua.Pop(1);

                    lua.GetField(3, "b");
                    _highlightColor.b = (float)lua.L_CheckNumber(-1);
                    lua.Pop(1);

                    lua.GetField(3, "a");
                    //_highlightColor.a = (float)lua.L_CheckNumber(-1);
                    float a = (float)lua.L_CheckNumber(-1);
                    lua.Pop(1);
                    //print("***** Entity highlight color " + _highlightColor);
                    return true;
            }

            return base.WidgetWriteOper(lua, key);
        }
开发者ID:cedar-x,项目名称:unilua_story,代码行数:45,代码来源:Entity.cs

示例10: StrFindAux

		private static int StrFindAux( ILuaState lua, bool find )
		{
			string s = lua.L_CheckString( 1 );
			string p = lua.L_CheckString( 2 );
			int init = PosRelative( lua.L_OptInt(3, 1), s.Length );
			if( init < 1 ) init = 1;
			else if( init > s.Length + 1 ) // start after string's end?
			{
				lua.PushNil(); // cannot find anything
				return 1;
			}
			// explicit request or no special characters?
			if( find && (lua.ToBoolean(4) || NoSpecials(p)) )
			{
				// do a plain search
				int pos = s.IndexOf( p, init-1 );
				if( pos >= 0 )
				{
					lua.PushInteger( pos+1 );
					lua.PushInteger( pos+p.Length );
					return 2;
				}
			}
			else
			{
				int s1 = init-1;
				int ppos = 0;
				bool anchor = p[ppos] == '^';
				if( anchor )
					ppos++; // skip anchor character

				MatchState ms = new MatchState();
				ms.Lua = lua;
				ms.Src = s;
				ms.SrcInit = s1;
				ms.SrcEnd = s.Length;
				ms.Pattern = p;
				ms.PatternEnd = p.Length;

				do
				{
					ms.Level = 0;
					int res = Match( ms, s1, ppos );
					if( res != -1 )
					{
						if(find)
						{
							lua.PushInteger( s1+1 ); // start
							lua.PushInteger( res );  // end
							return PushCaptures(lua, ms, -1, 0) + 2;
						}
						else return PushCaptures(lua, ms, s1, res);
					}
				} while( s1++ < ms.SrcEnd && !anchor );
			}
			lua.PushNil(); // not found
			return 1;
		}
开发者ID:Jornason,项目名称:UniLua,代码行数:58,代码来源:LuaStrLib.cs

示例11: B_Assert

 public static int B_Assert( ILuaState lua )
 {
     if( !lua.ToBoolean( 1 ) )
         return lua.L_Error( "{0}", lua.L_OptString( 2, "assertion failed!" ) );
     return lua.GetTop();
 }
开发者ID:matthewyang,项目名称:UniLua,代码行数:6,代码来源:LuaBaseLib.cs

示例12: Lua_LookTarget

 //-----------------------------
 int Lua_LookTarget(ILuaState lua)
 {
     LuaObject pLuaTarget = LuaObject.GetLuaObject(lua, 2);
     bool bSmooth = false;
     if (lua.Type(3) == LuaType.LUA_TBOOLEAN)
     {
         bSmooth = lua.ToBoolean(3);
     }
     if (pLuaTarget == null)
         LookTarget(null, bSmooth);
     else
         LookTarget(pLuaTarget.transform, bSmooth);
     return 0;
 }
开发者ID:cedar-x,项目名称:unilua_story,代码行数:15,代码来源:LuaGameCamera.cs

示例13: Lua_BackPoint

 int Lua_BackPoint(ILuaState lua)
 {
     bool bSmooth = false;
     if (lua.Type(2) == LuaType.LUA_TBOOLEAN)
     {
         bSmooth = lua.ToBoolean(2);
     }
     BackPoint(bSmooth);
     return 0;
 }
开发者ID:cedar-x,项目名称:unilua_story,代码行数:10,代码来源:LuaGameCamera.cs

示例14: WidgetWriteOper

        protected override bool WidgetWriteOper(ILuaState lua, string key)
        {
            switch (key)
            {
                case "isLoop":
                    _cameraPath.loop = (bool)lua.ToBoolean(3);
                    break;
                case "interpolation":
                    _cameraPath.interpolation = (CameraPath.Interpolation)lua.ToInteger(3);
                    break;
                case "animtarget":
                    LuaObject obj = LuaObject.GetLuaObject(lua, 3);
                    SetAnimTarget(obj.transform);
                    break;
                case "animMode":
                    _cameraAnimator.animationMode = (CameraPathAnimator.animationModes)lua.ToInteger(3);
                    break;
                case "speed":
                    _cameraAnimator.pathSpeed = (float)lua.ToNumber(3);
                    break;
                case "controlpoints":
                    lua.PushValue(3);
                    int count = lua.L_Len(-1);
                    _cameraPath.Clear();
                    for (int i = 1; i <= count; i++)
                    {
                        lua.PushNumber(i);
                        lua.GetTable(-2);

                        lua.PushString("controlpoint");
                        lua.GetTable(-2);
                        Vector3 controlPoint = GetVector3(lua, -1);
                        lua.Pop(1);
                        lua.PushString("forwardControlPoint");
                        lua.GetTable(-2);
                        Vector3 forwardControlPoint = GetVector3(lua, -1);
                        lua.Pop(1);
                        lua.PushString("backwardControlPoint");
                        lua.GetTable(-2);
                        Vector3 backwardControlPoint = GetVector3(lua, -1);
                        lua.Pop(1);

                        lua.Pop(1);
                        _cameraPath.AddPoint(controlPoint);
                        _cameraPath[i-1].forwardControlPoint = forwardControlPoint;
                        _cameraPath[i-1].backwardControlPoint = backwardControlPoint;
                    }
                    lua.Pop(1);
                    break;
                case "speedArr": //lsy add
                    //Debug.Log("-----------SPEED-------WRITE----------");
                    lua.PushValue(3);
                    int count2 = lua.L_Len(-1);
                    _cameraPath.speedList.Clear();
                    for (int i = 1; i <= count2; i++) {
                        lua.PushNumber(i);
                        lua.GetTable(-2);
                        Quaternion pointRotation = GetQuaternion(lua, -1);
                       //------------------------------------------
                        int point = -1, cpointA = -1, cpointB = -1;
                        float curvePercentage = 0f;
                        int speed = 0;

                        //free or fixedToPoint
                        lua.PushString("positionModes");
                        lua.GetTable(-2);
                        CameraPathPoint.PositionModes positionModes = (CameraPathPoint.PositionModes)lua.ToInteger(-1);
                        lua.Pop(1);

                        lua.PushString("percent");
                        lua.GetTable(-2);
                        float percent = (float)lua.ToNumber(-1);
                        lua.Pop(1);

                        lua.PushString("point");
                        lua.GetTable(-2);
                        if (lua.Type(-1) != LuaType.LUA_TNIL)
                            point = lua.ToInteger(-1);
                        lua.Pop(1);

                        lua.PushString("cpointA");
                        lua.GetTable(-2);
                        if (lua.Type(-1) != LuaType.LUA_TNIL)
                            cpointA = lua.ToInteger(-1);
                        lua.Pop(1);

                        lua.PushString("cpointB");
                        lua.GetTable(-2);
                        if (lua.Type(-1) != LuaType.LUA_TNIL)
                            cpointB = lua.ToInteger(-1);
                        lua.Pop(1);

                        lua.PushString("curvePercentage");
                        lua.GetTable(-2);
                        if (lua.Type(-1) != LuaType.LUA_TNIL)
                            curvePercentage = (float)lua.ToNumber(-1);
                        lua.Pop(1);

                        lua.PushString("speed");
                        lua.GetTable(-2);
//.........这里部分代码省略.........
开发者ID:cedar-x,项目名称:unilua_story,代码行数:101,代码来源:LuaPathCamera.cs

示例15: WidgetWriteOper

 /// //////////////////属性导出导入部分-有导入导出需求时重写///////////////////////////////////////////////
 protected override bool WidgetWriteOper(ILuaState lua, string key)
 {
     switch (key)
     {
         case "musicName":
             _normalInfo.musicName = lua.L_CheckString(-1);
             break;
         case "volume":
             _normalInfo.volume = (float)lua.L_CheckNumber(-1);
             break;
         case "bLoop":
             _normalInfo.bLoop = lua.ToBoolean(-1);
             break;
         default:
             return base.WidgetWriteOper(lua, key);
     }
     return true;
 }
开发者ID:cedar-x,项目名称:unilua_story,代码行数:19,代码来源:StoryMusicCtrl.cs


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