|
发表于 2007-5-27 12:01:56
|
显示全部楼层
弱问:你们怎么做到发的帖子jass代码高亮处理的?
承认没有看到谁处理code,的确他们加的都只是自定义的函数.
有一个WE叫Local Handle Var GUI,这个里面就有很多自定义函数,就是如同我说的方法1那么办的,最后把那些函数再贴过去.
比如下面是我自己用的一个小的代码库.这些函数对我还是有点用的.
如果都弄成GUI的,肯定用上比较爽. -
- //golbals
- globals
- gamecache udg_GameCache
- endglobals
- //--------------------Types-------------------------------------------
- //types
- function H2I takes handle h returns integer
- return 0
- endfunction
- //省略
- //--------------------GameCache-------------------------------------------
- //
- //GameCache
- function GameCacheInit takes nothing returns gamecache
- if udg_GameCache==null then
- call FlushGameCache(InitGameCache("GameCacheInit.w3x"))
- set udg_GameCache=InitGameCache("GameCacheInit.w3x")
- endif
- return udg_GameCache
- endfunction
- function FlushHandle takes handle h returns nothing
- call FlushStoredMission(GameCacheInit(),H2S(h))
- endfunction
- //integer
- function WriteInt takes handle h, string label, integer x returns nothing
- local string k=H2S(h)
- if x==0 then
- call FlushStoredInteger(GameCacheInit(),k,label)
- else
- call StoreInteger(GameCacheInit(),k,label,x)
- endif
- endfunction
- function ReadInt takes handle h, string label returns integer
- return GetStoredInteger(GameCacheInit(), H2S(h), label)
- endfunction
- function AddInt takes handle h, string label, integer x returns nothing
- local string k=H2S(h)
- if x==0 then
- call FlushStoredInteger(GameCacheInit(),k,label)
- else
- call StoreInteger(GameCacheInit(),k,label,x+ReadInt(h,label))
- endif
- endfunction
- //省略
- //-------------------Timer--------------------------------------------
- function RunTimer takes real timerout,code handlerFunc,boolean periodic returns timer
- local timer temp=CreateTimer()
- call TimerStart(temp,timerout,periodic,handlerFunc)
- return temp
- endfunction
- function CountAdd takes nothing returns nothing
- endfunction
- //省略
- //--------------------Points-------------------------------------------
- function AngleBPoints takes location a,location b returns real
- return Atan2(GetLocationY(b)-GetLocationY(a),GetLocationX(b)-GetLocationX(a))
- endfunction
- function AngleBUnits takes unit a,unit b returns real
- return Atan2(GetUnitY(b)-GetUnitY(a),GetUnitX(b)-GetUnitX(a))
- endfunction
- function AngleBPointsXY takes real x1, real y1, real x2, real y2 returns real
- return Atan2BJ((y2-y1),(x2-x1))
- endfunction
- //把一个单位移动到距点l,方向为a,距离为d的地方
- function MovePoint takes location l,real d,real a returns nothing
- call MoveLocation(l,d*Cos(a),d*Sin(a))
- endfunction
- //省略.
复制代码 |
|