logo资料库

客户端开发框架说明.docx

第1页 / 共92页
第2页 / 共92页
第3页 / 共92页
第4页 / 共92页
第5页 / 共92页
第6页 / 共92页
第7页 / 共92页
第8页 / 共92页
资料共92页,剩余部分请下载后查看
客户端目录说明(如下图):
function Wnd_room_info:ctor(game)
function Wnd_room_info:on_init()
8--
U3D引擎 :Unity 5.6.4p3 (64-bit) 项目使用tolua框架,C#脚本开接口 界面使用UGUI、DoTween 通信采用公司封装好的Buffer,进行解析和封包 大厅采用http与php服务器通信,游戏内部采用Socket与对应服务器通信。 开发工具 : vs2013、subline text3 插件使用 : 客户端打包win32说明: 1、不需要打assetbundle,首先先删除StreamingAssets目录下的资源, 2、点击Tools/Copy Lua,Ctrl + R(刷新)拷贝最新的lua代码到StreamingAssets目录下面, (不是AssetBundle/Copy Lua) 3、 Architecture 选择 x_86_64 , 点击Build即可完成win打包。
新增界面步骤 : 1、根据策划的需求、和美术的效果图,编辑好窗口prefab。(切记不可使用其他游戏内的 资源) 2、在对应游戏的Game_wnd_define.lua脚本中定义该窗口。 3、在对应游戏的Game.lua脚本中声明并注册窗口 声明:(声明Window下的所有Lua脚本) 4、注册:(用到Game_wnd_define中定义的窗口,游戏目录下Window文件夹的窗口预制体) 5、通过wnd_mgr窗口管理器对窗口进行打开、关闭隐藏等操作
客户端目录说明(如下图):
Lua 目录说明(如下图):
子游戏的目录结构(如下图):
function Wnd_room_info:ctor(game) function Wnd_room_info:on_init() 1-- 设置选中框颜色 function Widget_room_2015:select_text_changecolor(node_select, b_select) local text = node_select.transform:Find("Text"):Text() 获取相应的组件 if b_select then text:SetText("修改测试文本") text:SetColor(0.95, 0.78, 0.23, 1) text:SetColor(0.62, 0.68, 1, 1) else end end --设置人数的字体颜色 self.person_num = self.transform:Find("panel/Title/Text-1") local text=self.person_num:Find("Text"):Text()获取相应的组件 text:SetColor(0.95, 0.78, 0.23, 1) self.transform:GetComponent(typeof(UGUI.Image)).enabled = b_click 是否隐藏 self.card_bg:GetComponent(typeof(UGUI.Image)):SetColor(0.6, 0.6, 0.6, 1) majiang:Find("Image-icon"):GetComponent(typeof(UGUI.Image)):SetSprite(GameDef.MAJI ANG_CARD_ATLAS,tostring(card_value)) 设置图片 self.Points_value = self.Points:GetComponent(typeof(UGUI.Dropdown)).value self.node_player_list[local_pos]:GetComponent(typeof(UnityEngine.CanvasGroup)).alp ha = 1 --设置复选框 self.toggle_max = self.transform:Find("panel/Toggle-group/Toggle-max"):Toggle()获取
相应的组件 self.toggle_max:OnValueChanged( function(isOn) self:toggle_text_changecolor(self.toggle_max.transform, isOn) end ) desk_config.fdjd = self.toggle_max.isOn self.toggle_max.isOn = config.fdjd 获取相应的组件 local group = self.transform:Find("Root/Panel-operate"):GetComponent(typeof(UGUI.GridLayoutGroup) ) if count > 0 then if count == 1 then group:SetGridGroupSpacing(30, 0) elseif count == 2 then group:SetGridGroupSpacing(20, 0) elseif count == 3 then group:SetGridGroupSpacing(10, 0) else end end group:SetGridGroupSpacing(0, 0) --进度条颜色 self.value_progress:Image().fillAmount = end_time / self.game.game_module.free_total_time local image = scale_item:Image() image.fillAmount = 0 给user_info添加Widget_result_user_info self.widget_user[i] = LuaComponent.Add(user_info, Widget_result_user_info) lua脚本 self.card_list[i].transform.gameObject.activeSelf 得到该对象true显示/false隐藏 状 态 card.gameObject.activeSelf 2— self.wnd_mgr:register_window(Game_wnd_define.wnd_name_room_info, GameDef.GAME_WINDOW_DIR .. "wnd-room-info", Wnd_room_info) self.wnd_mgr:open_window(Game_wnd_define.wnd_name_room_info) self.wnd_mgr:get_window(Game_wnd_define.wnd_name_room_info) if wnd_player_new ~= nil and wnd_player_new:is_open() then self.btn_position:Show() self.btn_position:Hide() self.txt_room_id:SetText(" ") self.btn_change:OnClick( function() end ) 延迟调用:延迟0.5秒后调用 self:get_lua_component():Invoke( function()
self.game:quit_game() end, 0.5) -- 摊牌后显示结算信息 local sequence = DOTween.Sequence() sequence:InsertCallback(1.5, function() 延迟1.5秒后调用 wnd_game_result:update_ui() end ):SetUpdate(true) :SetLoops(self.max_connect_times - 1) -- 显示解散包间剩余时间 function Wnd_background:roomcut_time(i_seconds, b_off) if b_off then if self.second_sequence == nil then local end_time = i_seconds self.time_title:Show() self.second_sequence = DOTween.Sequence() self:set_remain_time(end_time) self.second_sequence:InsertCallback(1, function() end_time = end_time - 1 self:set_remain_time(end_time) if end_time <= 0 then end_time = 0 self.time_title:Hide() self.second_sequence:Kill(false) end end ):SetLoops(i_seconds):SetUpdate(true); end self.time_title:Hide() self:remove_scheduler() else end end -- @param func 回调函数 -- @param interval 触发间隔 -- @param delay_time 触发延时 -- @param times 触发次数 默认为1 -1为不限次数 0为不触发 -- @param end_time 触发器持续时间 0为不强制结束 -- @param handler 触发器拥有者 可以为字符串标记 延迟调用: function Scheduler.add(func, interval, delay_time, times, end_time, handler) end self.zhuang=Scheduler.add( function() pocan2:Hide() pocan1:Show() end ,0,1.85, nil, nil, self) local Room_module = require("Module.Room_module")
分享到:
收藏