本帖最后由 IamI 于 2014-5-17 09:52 编辑
fux2 发表于 2014-5-17 00:54
最近才知道已经有人在做类似工作了(自由扩充数据库及排版的编辑器)。
@IamI 大概你们能扯两句。 ...
一个月前的消息现在才来找我怎么想都是你的错啦(误)。
应该说,这个轮子造了好多年了……现在我却连让它滚都很难滚起来。
主体采用C#编写,编辑器开放编辑,采用IronRuby。
只写数据库界面,其他基本不考虑,不过数据库的工作量基本上和写一整个RM有的一比(趴)
Marshal 数年前就已经完备,布局引擎基本完好,只不过出于个人原因一直提不快库的开发速度。
近期和事件搏斗中。
为了解决库数量不足的问题不得已采用的策略。
基本已经可用。
全部可用,顺带一提下面那个防具配置差点让我想死,XP是没有双刀的,它的配置已经这么长:
Builder.Add(:lazy_choose , {:actual => :armor2_id , :label => 0, :textbook => Help.Get_Default_Text , :choice => { 0 => "(无)" }, :source => Proc.new do |target, parent, control| Data["armor"][Data["class"][parent["@class_id"]]["@armor_set"]].select {|target| target["@kind"].Value == 1} end })
Builder.Add(:lazy_choose , {:actual => :armor2_id , :label => 0, :textbook => Help.Get_Default_Text , :choice => { 0 => "(无)" },
:source => Proc.new do |target, parent, control|
Data["armor"][Data["class"][parent["@class_id"]]["@armor_set"]].select {|target| target["@kind"].Value == 1}
end })
有双刀的VA就是这个样子了
def search_weapon(control) actor_class = Data["class"][control.Container.Container.Value["@class_id"]] actor_features = control.Container.Container.Value["@features"] class_features = actor_class["@features"] type = [] banish = false actor_features.each do |feature| type.push(feature["@data_id"]) if feature["@code"].Value == 51 banish = true if feature["@code"].Value == 54 && feature["@data_id"] == 0 end class_features.each do |feature| type.push(feature["@data_id"]) if feature["@code"].Value == 51 banish = true if feature["@code"].Value == 54 && feature["@data_id"] == 0 end return [] if banish return Data["weapon"].select {|weapon| type.include?(weapon["@wtype_id"]) } end def search_armor(control, id) actor_class = Data["class"][control.Container.Container.Value["@class_id"]] actor_features = control.Container.Container.Value["@features"] class_features = actor_class["@features"] type = [] banish = false actor_features.each do |feature| type.push(feature["@data_id"]) if feature["@code"].Value == 52 banish = true if feature["@code"].Value == 54 && feature["@data_id"] == id end class_features.each do |feature| type.push(feature["@data_id"]) if feature["@code"].Value == 52 banish = true if feature["@code"].Value == 54 && feature["@data_id"] == id end return [] if banish return Data["armor"].select {|weapon| type.include?(weapon["@atype_id"]) && weapon["@etype_id"].Value == id } end def isDouble(control) actor_class = Data["class"][control.Container.Container.Value["@class_id"]] actor_features = control.Container.Container.Value["@features"] class_features = actor_class["@features"] for feature in class_features return true if feature["@code"].Value == 55 end for feature in actor_features return true if feature["@code"].Value == 55 end false end
def search_weapon(control)
actor_class = Data["class"][control.Container.Container.Value["@class_id"]]
actor_features = control.Container.Container.Value["@features"]
class_features = actor_class["@features"]
type = []
banish = false
actor_features.each do |feature|
type.push(feature["@data_id"]) if feature["@code"].Value == 51
banish = true if feature["@code"].Value == 54 && feature["@data_id"] == 0
end
class_features.each do |feature|
type.push(feature["@data_id"]) if feature["@code"].Value == 51
banish = true if feature["@code"].Value == 54 && feature["@data_id"] == 0
end
return [] if banish
return Data["weapon"].select {|weapon| type.include?(weapon["@wtype_id"]) }
end
def search_armor(control, id)
actor_class = Data["class"][control.Container.Container.Value["@class_id"]]
actor_features = control.Container.Container.Value["@features"]
class_features = actor_class["@features"]
type = []
banish = false
actor_features.each do |feature|
type.push(feature["@data_id"]) if feature["@code"].Value == 52
banish = true if feature["@code"].Value == 54 && feature["@data_id"] == id
end
class_features.each do |feature|
type.push(feature["@data_id"]) if feature["@code"].Value == 52
banish = true if feature["@code"].Value == 54 && feature["@data_id"] == id
end
return [] if banish
return Data["armor"].select {|weapon| type.include?(weapon["@atype_id"]) && weapon["@etype_id"].Value == id }
end
def isDouble(control)
actor_class = Data["class"][control.Container.Container.Value["@class_id"]]
actor_features = control.Container.Container.Value["@features"]
class_features = actor_class["@features"]
for feature in class_features
return true if feature["@code"].Value == 55
end
for feature in actor_features
return true if feature["@code"].Value == 55
end
false
end
写了超过2000行配置代码了,依然看不到头。
我在使用XML描述的编辑器界面上浪费了两年时间。编辑器逻辑用Ruby描述尚显的吃力,用XML描述基本达不到目标要求。
如果您有兴趣,请造访这里
这个是最后一个使用XML描述的版本。已经废弃。
|