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


C# ILuaState.Type方法代码示例

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


在下文中一共展示了ILuaState.Type方法的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: TBL_MaxN

		private static int TBL_MaxN( ILuaState lua )
		{
			double max = 0.0;
			lua.L_CheckType( 1, LuaType.LUA_TTABLE );

			lua.PushNil(); // first key
			while( lua.Next(1) )
			{
				lua.Pop( 1 ); // remove value
				if( lua.Type( -1 ) == LuaType.LUA_TNUMBER ) {
					double v = lua.ToNumber( -1 );
					if( v > max ) max = v;
				}
			}
			lua.PushNumber( max );
			return 1;
		}
开发者ID:jaydenh,项目名称:UniLua,代码行数:17,代码来源:LuaTableLib.cs

示例3: lua_CameraFadeTo

		private int lua_CameraFadeTo(ILuaState lua)
		{
			LuaObject luaObj = LuaObject.GetLuaObject (lua, 2);
			if (luaObj == null)
				return 0;
			
			if (lua.Type (3) != LuaType.LUA_TTABLE) {
				return 0;
			}
			Hashtable hashTable = ItweenAdaptHasHTable(lua);
			iTween.CameraFadeTo (hashTable);
			
			return 0;
		}
开发者ID:cedar-x,项目名称:unilua_story,代码行数:14,代码来源:LuaItween.cs

示例4: B_ToNumber

 public static int B_ToNumber( ILuaState lua )
 {
     LuaType t = lua.Type( 2 );
     if( t == LuaType.LUA_TNONE || t == LuaType.LUA_TNIL ) // standard conversion
     {
         bool isnum;
         double n = lua.ToNumberX( 1, out isnum );
         if( isnum )
         {
             lua.PushNumber( n );
             return 1;
         } // else not a number; must be something
         lua.L_CheckAny( 1 );
     }
     else
     {
         string s = lua.L_CheckString( 1 );
         int numBase = lua.L_CheckInteger( 2 );
         bool negative = false;
         lua.L_ArgCheck( (2 <= numBase && numBase <= 36), 2,
             "base out of range" );
         s = s.Trim( ' ', '\f', '\n', '\r', '\t', '\v' );
         s = s + '\0'; // guard
         int pos = 0;
         if(s[pos] == '-') { pos++; negative = true; }
         else if(s[pos] == '+') pos++;
         if( Char.IsLetterOrDigit( s, pos ) )
         {
             double n = 0.0;
             do
             {
                 int digit;
                 if( Char.IsDigit( s, pos ) )
                     digit = Int32.Parse( s[pos].ToString() );
                 else
                     digit = Char.ToUpper( s[pos] ) - 'A' + 10;
                 if( digit >= numBase )
                     break; // invalid numeral; force a fail
                 n = n * (double)numBase + (double)digit;
                 pos++;
             } while( Char.IsLetterOrDigit( s, pos ) );
             if( pos == s.Length - 1 ) // except guard, no invalid trailing characters?
             {
                 lua.PushNumber( negative ? -n : n );
                 return 1;
             } // else not a number
         } // else not a number
     }
     lua.PushNil(); // not a number
     return 1;
 }
开发者ID:matthewyang,项目名称:UniLua,代码行数:51,代码来源:LuaBaseLib.cs

示例5: B_Select

 public static int B_Select( ILuaState lua )
 {
     int n = lua.GetTop();
     if( lua.Type( 1 ) == LuaType.LUA_TSTRING &&
         lua.ToString( 1 )[0] == '#' )
     {
         lua.PushInteger( n-1 );
         return 1;
     }
     else
     {
         int i = lua.L_CheckInteger( 1 );
         if( i < 0 ) i = n + i;
         else if( i > n ) i = n;
         lua.L_ArgCheck( 1 <= i, 1, "index out of range" );
         return n - i;
     }
 }
开发者ID:matthewyang,项目名称:UniLua,代码行数:18,代码来源:LuaBaseLib.cs

示例6: Str_Gsub

		private static int Str_Gsub( ILuaState lua )
		{
			
			string src = lua.L_CheckString(1);
			int srcl = src.Length;
			string p = lua.L_CheckString(2);
			LuaType tr = lua.Type(3);
			int max_s = lua.L_OptInt(4, srcl + 1);
			int anchor = 0;
			if (p[0] == '^')
			{
                p = p.Substring(1);
                anchor = 1;
			}
			int n = 0;
			MatchState ms = new MatchState();
			StringBuilder b = new StringBuilder(srcl);
			lua.L_ArgCheck(tr == LuaType.LUA_TNUMBER || tr == LuaType.LUA_TSTRING ||
						   tr == LuaType.LUA_TFUNCTION || tr == LuaType.LUA_TTABLE, 3,
							  "string/function/table expected");
			ms.Lua = lua;
			ms.Src = src;
			ms.SrcInit = 0;
			ms.SrcEnd = srcl;
			ms.Pattern = p;
			ms.PatternEnd = p.Length;
			int s = 0;
			while (n < max_s) {
			   ms.Level = 0;
			   int e = Match(ms, s, 0);
			   if (e != -1) {
			       n++;
				   Add_Value(ms, b, s, e);
			   }
			   if ((e != -1) && e > s) /* non empty match? */
			      s = e;  /* skip it */
			   else if (s < ms.SrcEnd)
			   {
			       char c = src[s];
				   ++s;
			       b.Append(c);
			   }
			   else break;
			   if (anchor != 0) break;
		    }
			b.Append(src.Substring(s, ms.SrcEnd - s));
			lua.PushString(b.ToString());
		    lua.PushInteger(n);  /* number of substitutions */
		    return 2;
		}
开发者ID:Jornason,项目名称:UniLua,代码行数:50,代码来源:LuaStrLib.cs

示例7: Lua_Flush

        int Lua_Flush(ILuaState lua)
        {
            bool bSmooth = false;
            if (lua.Type(2) == LuaType.LUA_TBOOLEAN)
            {
                bSmooth = lua.ToBoolean(2);
            }
            if (lua.Type(3) == LuaType.LUA_TTABLE)
            {
                lua.PushValue(3);
                ml_paramTab = LuaItween.ItweenParamHasHTable(lua, m_callBackFun);
                if (m_callBackFun.dwConpleteFun != 0)
                {
                    ml_paramTab.Add("oncompleteparams", m_callBackFun);
                }
                if (m_callBackFun.dwStartFun != 0)
                {
                    ml_paramTab.Add("onstartparams", m_callBackFun);
                }
                if (m_callBackFun.dwUpdateFun != 0)
                {
                    ml_paramTab.Add("onupdateparams", m_callBackFun);
                }

                ml_paramTab.Add("onstarttarget", gameObject);
                ml_paramTab.Add("onupdatetarget", gameObject);
                ml_paramTab.Add("oncompletetarget", gameObject); 
            }
            calculatePos(bSmooth);
            return 0;
        }
开发者ID:cedar-x,项目名称:unilua_story,代码行数:31,代码来源:LuaGameCamera.cs

示例8: Lua_ResetParam

        int Lua_ResetParam(ILuaState lua)
        {
            LuaObject pLuaTarget = LuaObject.GetLuaObject(lua, 2);
            if (pLuaTarget == null)
            {
                Debug.LogWarning("LuaGameCamera ResetParam param1 is not luaObject....");
                return 0;
            }

            bool bChangeTarget = false;
            if (lua.Type(3) == LuaType.LUA_TBOOLEAN)
            {
                bChangeTarget = lua.ToBoolean(3);
            }
            ResetParam(pLuaTarget.transform);

            return 0;
        }
开发者ID:cedar-x,项目名称:unilua_story,代码行数:18,代码来源:LuaGameCamera.cs

示例9: WidgetWriteOper

        protected override bool WidgetWriteOper(ILuaState lua, string key)
        {
            switch (key)
            {
                case "target":
                    LuaObject obj = LuaObject.GetLuaObject(lua, 3);
                    if (obj != null)
                        target = obj.transform;
                    else
                        target = null;
                    break;
                case "type":
                    type = (CameraCastType)lua.ToInteger(3);
                    return true;
                case "depth":
                    _camera.depth = lua.ToInteger(3);
                    return true;
                case "distance":
                    m_normalInfo.distance = lua.ToInteger(3);
                    return true;
                case "LRAngle":
                    SetLRAngle((float)lua.L_CheckNumber(3));
                    return true;
                case "UDAngle":
                    SetUDAngle((float)lua.L_CheckNumber(3));
                    return true;
                case "offsetX":
                    m_normalInfo.offSet.x = (float)lua.L_CheckNumber(3);
                    return true;
                case "offsetY":
                    m_normalInfo.offSet.y = (float)lua.L_CheckNumber(3);
                    return true;
                case "offsetZ":
                    m_normalInfo.offSet.z = (float)lua.L_CheckNumber(3);
                    return true;
                case "offset":
                    {
                        if (lua.Type(3) != LuaType.LUA_TTABLE)
                        {
                            Debug.LogWarning("LuaGameCamera set offset attribute parm table excepted.");
                            return true;
                        }
                        Vector3 ve = m_normalInfo.offSet;

                        lua.GetField(3, "x");
                        ve.x = (float)lua.L_CheckNumber(-1);
                        lua.Pop(1);

                        lua.GetField(3, "y");
                        ve.y = (float)lua.L_CheckNumber(-1);
                        lua.Pop(1);

                        lua.GetField(3, "z");
                        ve.z = (float)lua.L_CheckNumber(-1);
                        lua.Pop(1);

                        m_normalInfo.offSet= ve;
                    }
                    return true;
            }
            //return false;
            return base.WidgetWriteOper(lua, key);
        }
开发者ID:cedar-x,项目名称:unilua_story,代码行数:63,代码来源:LuaGameCamera.cs

示例10: Lua_Play3DSound

        private static int Lua_Play3DSound(ILuaState lua)
        {
            string name = lua.L_CheckString(2);

            float fDelay = 0;
            if (lua.Type(3) == LuaType.LUA_TNUMBER)
            {
                fDelay = (float)lua.ToNumber(3);
            }
            PlaySound(name, 0, 0, 0, fDelay);
            return 0;
        }
开发者ID:cedar-x,项目名称:unilua_story,代码行数:12,代码来源:AudioManager.cs

示例11: 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

示例12: Lua_Play

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

示例13: 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

示例14: Lua_FlyAction

        // zsy add
        private int Lua_FlyAction(ILuaState lua)
        {
            LuaObject luaObj = LuaObject.GetLuaObject(lua, 2);
            if (luaObj == null)
                return 0;

            if (lua.Type(3) != LuaType.LUA_TTABLE)
            {
                return 0;
            }
            Hashtable hashTable = MoveControllerAdaptHasHTable(lua);

            //moveController.DoFlyEffect(luaObj.transform, hashTable);
			
            return 0;
        }
开发者ID:cedar-x,项目名称:unilua_story,代码行数:17,代码来源:LuaItween.cs

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