找回密码
 点一下
查看: 2146|回复: 28

位面消隐——本身可不同步的handle一部分补充Demo

[复制链接]
发表于 2009-8-20 18:09:50 | 显示全部楼层 |阅读模式
增加以下可不同步handle的内容:
[jass]
special effect
texttag
weather
lightning
fogmodifier
[/jass]
包括以前的:
[jass]
destructable
terrain -all
[/jass]
都支持了动态的
创建/删除/更改不同步数据
同步数据也给出了更改方法。

…………………………
加了这个………………居然多了1000+行………………

突然发现我这个地图,作者还是未知呢………………

System_Effect.w3x

197 KB, 下载次数: 26

发表于 2009-8-20 18:17:44 | 显示全部楼层
这些非常棒……
其实我觉得你的每一次更新都可以加精……
回复

使用道具 举报

发表于 2009-8-20 18:18:13 | 显示全部楼层
额。对了你的是124嘛?
回复

使用道具 举报

发表于 2009-8-20 18:21:52 | 显示全部楼层
什么东东?
回复

使用道具 举报

发表于 2009-8-20 18:31:20 | 显示全部楼层
位面消隐~可是好东西呢~
看介绍罢~
回复

使用道具 举报

 楼主| 发表于 2009-8-20 18:37:15 | 显示全部楼层
…………………………在除了1.24其他版本都可以使用。
其实就是用了一个H2I,其余的Union和ReturnBug都没有使用。
真要弄1.24也很好弄。
回复

使用道具 举报

 楼主| 发表于 2009-8-20 18:39:21 | 显示全部楼层
更新的
effect,weathereffect,texttag,fogmodifier,lightning
的代码:
[jass]
globals
    Effect array                All_Effects
    integer                     All_Effects_Number                             = 0
endglobals

struct Effect

    static integer              MaxNumber                                      = 500

    real                        x
    real                        y
    widget                      target
    string                      attach
   
    string                      model
   
    effect                      e
   
    Effect                      before
    Effect                      next
    static Effect               top                                            = 0

    method GetIndex takes World P returns integer
        return P * Effect.MaxNumber + this
    endmethod
   
    method init takes nothing returns nothing
        local World W = GetUser( GetLocalPlayer() ).Place
        local Effect move = this.GetIndex( W - 1 )
        if this.e != null then
            call DestroyEffect( this.e )
        endif
        if this.target != null then
            set this.e = AddSpecialEffectTarget( move.model, this.target, this.attach )
        else
            set this.e = AddSpecialEffect( move.model, this.x, this.y )
        endif
    endmethod
   
    static method initAll takes nothing returns nothing
        local Effect this = Effect.top
        loop
            exitwhen this == 0
            call this.init()
            set this = this.next
        endloop
    endmethod
   
    method updateModel takes World W, string model returns nothing
        local Effect move = this.GetIndex( W - 1 )
        set move.model = model
        if IsPlayerInForce( GetLocalPlayer(), W.Users ) then
            call this.init()
        endif
    endmethod
   
    //if update other member values, call the method: init()
   
    static method create takes real x, real y, widget target, string attach returns Effect
        local Effect new = Effect.allocate()
        local Effect move = 0
        local integer i = 0
        set new.x = x
        set new.y = y
        set new.target = target
        set new.attach = attach
        if Effect.top != 0 then
            set new.before = 0
            set new.next = Effect.top
        endif
        set Effect.top = new
        loop
            exitwhen i >= Const_WorldNumber
            set move = new.GetIndex( i )
            set move.model = Register_EffectModels
            set i = i + 1
        endloop
        return new
    endmethod
   
    method Delete takes nothing returns nothing
        set this.x = 0.0
        set this.y = 0.0
        if this.before == 0 then
            set Effect.top = this.next
        else
            set this.before.next = this.next
        endif
        if this.next != 0 then
            set this.next.before = this.before
        endif
        set this.next = 0
        set this.before = 0
        call this.destroy()
    endmethod
   
endstruct

struct TextTag
   
    static integer              MaxNumber                                      = 500

    boolean                     show

    texttag                     t
   
    TextTag                     before
    TextTag                     next
    static TextTag              top                                            = 0

    method GetIndex takes World P returns integer
        return P * TextTag.MaxNumber + this
    endmethod
   
    method change takes player p, World W returns nothing
        local TextTag move = this.GetIndex( W - 1 )
        if move.show then
            if GetLocalPlayer() == p then
                call SetTextTagVisibility( this.t, true )
            endif
        else
            if GetLocalPlayer() == p then
                call SetTextTagVisibility( this.t, false )
            endif
        endif
    endmethod
   
    static method changeAll takes player p, World W returns nothing
        local TextTag this = TextTag.top
        loop
            exitwhen this == 0
            call this.change( p, W )
            set this = this.next
        endloop
    endmethod
   
    method init takes nothing returns nothing
        local World W = GetUser( GetLocalPlayer() ).Place
        local TextTag move = this.GetIndex( W - 1 )
        if this.t != null then
            if move.show then
                call SetTextTagVisibility( this.t, true )
            else
                call SetTextTagVisibility( this.t, false )
            endif
        endif
    endmethod
   
    method updateShow takes World W, boolean show returns nothing
        local TextTag move = this.GetIndex( W - 1 )
        set move.show = show
        if IsPlayerInForce( GetLocalPlayer(), W.Users ) then
            call this.init()
        endif   
    endmethod
   
    //if update other member values, call the method: init()
   
    static method create takes texttag t returns TextTag
        local TextTag new = TextTag.allocate()
        local TextTag move = 0
        local integer i = 0
        set new.t = t
        if TextTag.top != 0 then
            set new.before = 0
            set new.next = TextTag.top
        endif
        set TextTag.top = new
        loop
            exitwhen i >= Const_WorldNumber
            set move = new.GetIndex( i )
            set move.show = Register_TextTagShows
            set i = i + 1
        endloop
        return new
    endmethod
   
    method Delete takes nothing returns nothing
        set this.t = null
        if this.before == 0 then
            set TextTag.top = this.next
        else
            set this.before.next = this.next
        endif
        if this.next != 0 then
            set this.next.before = this.before
        endif
        set this.next = 0
        set this.before = 0
        call this.destroy()
    endmethod
   
endstruct

struct Weather
   
    static integer              MaxNumber                                      = 500

    boolean                     show

    weathereffect               t
   
    Weather                     before
    Weather                     next
    static Weather              top                                            = 0

    method GetIndex takes World P returns integer
        return P * Weather.MaxNumber + this
    endmethod
   
    method change takes player p, World W returns nothing
        local Weather move = this.GetIndex( W - 1 )
        if move.show then
            if GetLocalPlayer() == p then
                call EnableWeatherEffect( this.t, true )
            endif
        else
            if GetLocalPlayer() == p then
                call EnableWeatherEffect( this.t, false )
            endif
        endif
    endmethod
   
    static method changeAll takes player p, World W returns nothing
        local Weather this = Weather.top
        loop
            exitwhen this == 0
            call this.change( p, W )
            set this = this.next
        endloop
    endmethod
   
    method init takes nothing returns nothing
        local World W = GetUser( GetLocalPlayer() ).Place
        local Weather move = this.GetIndex( W - 1 )
        if move.show then
            call EnableWeatherEffect( this.t, true )
        else
            call EnableWeatherEffect( this.t, false )
        endif
    endmethod

    method updateShow takes World W, boolean show returns nothing
        local Weather move = this.GetIndex( W - 1 )
        set move.show = show
        if IsPlayerInForce( GetLocalPlayer(), W.Users ) then
            call this.init()
        endif   
    endmethod
   
    //if update other member values, call the method: init()
   
    static method create takes weathereffect t returns Weather
        local Weather new = Weather.allocate()
        local Weather move = 0
        local integer i = 0
        set new.t = t
        if Weather.top != 0 then
            set new.before = 0
            set new.next = Weather.top
        endif
        set Weather.top = new
        loop
            exitwhen i >= Const_WorldNumber
            set move = new.GetIndex( i )
            set move.show = Register_WeatherShows
            set i = i + 1
        endloop
        return new
    endmethod
   
    method Delete takes nothing returns nothing
        set this.t = null
        if this.before == 0 then
            set Weather.top = this.next
        else
            set this.before.next = this.next
        endif
        if this.next != 0 then
            set this.next.before = this.before
        endif
        set this.next = 0
        set this.before = 0
        call this.destroy()
    endmethod
   
endstruct

struct Lightning
   
    static integer              MaxNumber                                      = 500

    real                        alpha

    lightning                   t
   
    Lightning                   before
    Lightning                   next
    static Lightning            top                                            = 0

    method GetIndex takes World P returns integer
        return P * Lightning.MaxNumber + this
    endmethod
   
    static method SetLightningAlpha takes lightning l, real a returns boolean
        return SetLightningColor( l, GetLightningColorR(l), GetLightningColorG(l), GetLightningColorB(l), a )
    endmethod
   
    method change takes player p, World W returns nothing
        local Lightning move = this.GetIndex( W - 1 )
        if GetLocalPlayer() == p then
            call Lightning.SetLightningAlpha( this.t, move.alpha )
        endif
    endmethod
   
    static method changeAll takes player p, World W returns nothing
        local Lightning this = Lightning.top
        loop
            exitwhen this == 0
            call this.change( p, W )
            set this = this.next
        endloop
    endmethod
   
    method init takes nothing returns nothing
        local World W = GetUser( GetLocalPlayer() ).Place
        local Lightning move = this.GetIndex( W - 1 )
        call Lightning.SetLightningAlpha( this.t, move.alpha )
    endmethod

    method updateAlpha takes World W, real alpha returns nothing
        local Lightning move = this.GetIndex( W - 1 )
        set move.alpha = alpha
        if IsPlayerInForce( GetLocalPlayer(), W.Users ) then
            call this.init()
        endif   
    endmethod
   
    //if update other member values, call the method: init()
   
    static method create takes lightning t returns Lightning
        local Lightning new = Lightning.allocate()
        local Lightning move = 0
        local integer i = 0
        set new.t = t
        if Lightning.top != 0 then
            set new.before = 0
            set new.next = Lightning.top
        endif
        set Lightning.top = new
        loop
            exitwhen i >= Const_WorldNumber
            set move = new.GetIndex( i )
            set move.alpha = Register_LightningAlphas
            set i = i + 1
        endloop
        return new
    endmethod
   
    method Delete takes nothing returns nothing
        set this.t = null
        if this.before == 0 then
            set Lightning.top = this.next
        else
            set this.before.next = this.next
        endif
        if this.next != 0 then
            set this.next.before = this.before
        endif
        set this.next = 0
        set this.before = 0
        call this.destroy()
    endmethod
   
endstruct

struct FogModifier
   
    static integer              MaxNumber                                      = 500

    boolean                     show

    fogmodifier                 t
   
    FogModifier                 before
    FogModifier                 next
    static FogModifier          top                                            = 0

    method GetIndex takes World P returns integer
        return P * FogModifier.MaxNumber + this
    endmethod
   
    method change takes player p, World W returns nothing
        local FogModifier move = this.GetIndex( W - 1 )
        if move.show then
            if GetLocalPlayer() == p then
                call FogModifierStart( this.t )
            endif
        else
            if GetLocalPlayer() == p then
                call FogModifierStop( this.t )
            endif
        endif
    endmethod
   
    static method changeAll takes player p, World W returns nothing
        local FogModifier this = FogModifier.top
        loop
            exitwhen this == 0
            call this.change( p, W )
            set this = this.next
        endloop
    endmethod
   
    method init takes nothing returns nothing
        local World W = GetUser( GetLocalPlayer() ).Place
        local FogModifier move = this.GetIndex( W - 1 )
        if move.show then
            call FogModifierStart( this.t )
        else
            call FogModifierStop( this.t )
        endif
    endmethod

    method updateShow takes World W, boolean show returns nothing
        local FogModifier move = this.GetIndex( W - 1 )
        set move.show = show
        if IsPlayerInForce( GetLocalPlayer(), W.Users ) then
            call this.init()
        endif   
    endmethod
   
    //if update other member values, call the method: init()
   
    static method create takes fogmodifier t returns FogModifier
        local FogModifier new = FogModifier.allocate()
        local FogModifier move = 0
        local integer i = 0
        set new.t = t
        if FogModifier.top != 0 then
            set new.before = 0
            set new.next = FogModifier.top
        endif
        set FogModifier.top = new
        loop
            exitwhen i >= Const_WorldNumber
            set move = new.GetIndex( i )
            set move.show = Register_FogModifierShows
            set i = i + 1
        endloop
        return new
    endmethod
   
    method Delete takes nothing returns nothing
        set this.t = null
        if this.before == 0 then
            set FogModifier.top = this.next
        else
            set this.before.next = this.next
        endif
        if this.next != 0 then
            set this.next.before = this.before
        endif
        set this.next = 0
        set this.before = 0
        call this.destroy()
    endmethod
   
endstruct
[/jass]
如果看不到请和我说。
回复

使用道具 举报

发表于 2009-8-20 18:42:12 | 显示全部楼层
看到了
突然发现原来我是看得懂这些东西的……
只是不会用
回复

使用道具 举报

 楼主| 发表于 2009-8-20 18:43:06 | 显示全部楼层
会VJASS?
挺好的嘛~~
发现做完item之后,第一版就可以出炉了~~
回复

使用道具 举报

发表于 2009-8-20 18:59:44 | 显示全部楼层
可以完全告诉你~不会VJ~
仅仅是看得懂~从语言和猜测加上结合上下文~
回复

使用道具 举报

发表于 2009-8-20 19:05:28 | 显示全部楼层
物品的消隐?
麻烦事
回复

使用道具 举报

 楼主| 发表于 2009-8-20 19:12:12 | 显示全部楼层
就是就是
回复

使用道具 举报

发表于 2009-8-20 19:17:32 | 显示全部楼层
用缓存……罢?
回复

使用道具 举报

 楼主| 发表于 2009-8-20 19:22:17 | 显示全部楼层
什么?
缓存?
什么意思……………………
回复

使用道具 举报

发表于 2009-8-20 19:25:57 | 显示全部楼层
就是cache记录嘛……能不
回复

使用道具 举报

 楼主| 发表于 2009-8-20 19:28:15 | 显示全部楼层
…………………………………………………………………………
看来LS完全不明白这玩意该怎么做………………
回复

使用道具 举报

发表于 2009-8-20 19:32:37 | 显示全部楼层
同意。
回复

使用道具 举报

发表于 2009-8-20 19:43:55 | 显示全部楼层
GC么?
我宁可自己开发存储系统也不用它
回复

使用道具 举报

发表于 2009-8-20 19:47:48 | 显示全部楼层
GC是GCTV的GC末?
回复

使用道具 举报

 楼主| 发表于 2009-8-20 19:49:37 | 显示全部楼层
必然不是。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 点一下

本版积分规则

Archiver|移动端|小黑屋|地精研究院

GMT+8, 2024-10-29 04:17 , Processed in 0.501270 second(s), 21 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表