源战役客户端
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 
 

166 líneas
6.0 KiB

ModelPreviewCon = ModelPreviewCon or BaseClass(BaseItem)
function ModelPreviewCon:__init(parent)
self.parent = parent
self.base_file = "common"
self.layout_file = "ModelPreviewCon"
self.layer_name = "Top"
self.mainVo = RoleManager.Instance.mainRoleInfo
-- self.use_local_view = true
self:Load()
end
function ModelPreviewCon:Load_callback()
self.bg = self:GetChild("bg")
self.ModelBG = self:GetChild("bg/ModelBG")
self.ModelCon = self:GetChild("ModelCon")
if self.need_refreshData then
self:SetData(self.type_id,self.curr_height)
end
self:InitEvent()
end
function ModelPreviewCon:InitEvent()
end
function ModelPreviewCon:__delete()
self:StopAnim()
end
function ModelPreviewCon:SetData( type_id ,curr_height)
self.type_id = type_id
self.curr_height = curr_height
if self.is_loaded then
self.need_refreshData = false
self.transform.anchoredPosition = Vector2(-702, 0)
self.bg.sizeDelta = Vector2(370, self.curr_height)
self.ModelCon.sizeDelta = Vector2(370, self.curr_height-50)
self.ModelCon.transform.anchoredPosition = Vector2(0, -self.curr_height/2)
self.ModelBG.sizeDelta = Vector2(356, self.curr_height-10)
self:StopAnim()
self:ShowModelPreview()
else
self.need_refreshData = true
end
end
function ModelPreviewCon:ShowModelPreview( )
if Config.ConfigModelPreview[self.type_id] then
local cfg = Config.ConfigModelPreview[self.type_id]
local model_id, texture_id = self.mainVo:GetRoleClotheId()
local weapon_model_id, weapon_texture_id = self.mainVo:GetWeaponClotheId()
local head_model_id,head_clothe_id = self.mainVo:GetRoleHeadId()
local fashion_model_id, fashion_texture_id = self.mainVo:GetRoleClotheTextureId()
local footmark_id = 0
local Scene_Type = SceneBaseType.Monster
if cfg.type == 5 then
self.transform.anchoredPosition = Vector2(-486, 0)
end
if cfg.type == 4 or cfg.type == 9 then--时装,限时时装
Scene_Type = SceneBaseType.Role
local type_id = self.type_id
if cfg.type == 9 then
type_id = cfg.model_id
end
local config = Config.Fashionmodel[cfg.subtype.."@"..type_id.."@"..self.mainVo.career]
if config then
if cfg.subtype == FashionPartPos.Clothe then
fashion_model_id = config.model_id
fashion_texture_id = config.color_id or 0
elseif cfg.subtype == FashionPartPos.Weapon then
weapon_model_id = config.model_id
weapon_texture_id = config.color_id or 0
elseif cfg.subtype == FashionPartPos.Head then
head_model_id = config.model_id
head_clothe_id = config.color_id or 0
elseif cfg.subtype == FashionPartPos.Footmark then
footmark_id = config.model_id
end
else
print("服装预览找不到配置")
end
else
model_id = cfg.model_id
fashion_model_id = model_id
fashion_texture_id = 0
weapon_model_id = model_id
weapon_texture_id = model_id
head_model_id = 0
head_clothe_id = 0
end
local data
if cfg.type == 4 and cfg.subtype == FashionPartPos.Footmark then
data = {
career = self.mainVo.career,
sex = self.mainVo.sex,
clothe_res_id = model_id,
weapon_res_id = weapon_model_id,
weapon_clothe_id = weapon_texture_id,
type = SceneBaseType.Role,
layer_name = self.layer_name,
rotate = 45,
action_name_list = {"run"},
can_rotate = false,
scale = cfg.scale,
position = cfg.position,
fashion_model_id = fashion_model_id,
texture_id = fashion_texture_id,
head_wear_id = head_model_id,
head_clothe_id = head_clothe_id,
footmark_id = footmark_id,
layout_file = self.layout_file
}
elseif cfg.type == 11 or cfg.type == 12 then
data = {
res_id = model_id,
texture_id = 0,
modelPartPos = FashionPartPos.Weapon,
type = Config.UIModelConfig[model_id] and Config.UIModelConfig[model_id].type or 3,
raycastParent = false,
layer_name = self.layer_name,
-- action_delta = 100,
rotate = cfg.rotate or 0,
can_rotate = false,
texture_size = {x = 300, y = 300},
scale = cfg.scale,
position = cfg.position,
}
else
data = {
career = self.mainVo.career,
sex = self.mainVo.sex,
clothe_res_id = model_id,
weapon_res_id = weapon_model_id,
weapon_clothe_id = weapon_texture_id,
type = Scene_Type,
layer_name = self.layer_name,
scale = cfg.scale,
position = cfg.position,
fashion_model_id = fashion_model_id,
texture_id = fashion_texture_id,
head_wear_id = head_model_id,
head_clothe_id = head_clothe_id,
rotate = cfg.rotate or 0,
}
end
if cfg.type == 11 or cfg.type == 12 then
self:FloatUDAnima()
lua_resM:NewSetPartModel(self, self.ModelCon, data)
else
lua_resM:SetRoleModel(self, self.ModelCon,data)
end
end
end
--武器的上下浮动效果
function ModelPreviewCon:FloatUDAnima()
self.tween_id3 =TweenLite.to(self, self.ModelCon,TweenLite.UiAnimationType.ANCHORED_POSY,-140, 1.5, call_fun,TweenFunc.PINGPONG,true)
end
function ModelPreviewCon:StopAnim()
if self.tween_id3 then
TweenLite.Stop(self.tween_id3)
self.tween_id3 = nil
end
end