local GConst = {} GConst.NOT_VISIBLE_POS = 10000000000 local CONST_PATHS = { StageConst = "app/module/stage/stage_const", ItemConst = "app/module/item/item_const", TaskConst = "app/module/task/task_const", MainCityConst = "app/module/maincity/maincity_const", TipsConst = "app/module/tips/tips_const", TutorialConst = "app/module/tutorial/tutorial_const", BattleConst = "app/module/battle/battle_const", HeroConst = "app/module/hero/hero_const", FormationConst = "app/module/formation/formation_const", } if EDITOR_MODE then GConst.ItemConst = require("app/module/item/item_const") end local CONST_METATABLE = { __index = function(t, k) local path = CONST_PATHS[k] if path == nil then Logger.logError("%s path is not configure in global_const.lua", k) return end local v = require(path) rawset(t, k, v) return v end } setmetatable(GConst, CONST_METATABLE) GConst.ANDROID_STORE_URL = "https://play.google.com/store/apps/details?id=com.cobby.lonelysurvivor" GConst.IOS_STORE_URL = "https://itunes.apple.com/app/1637393009" GConst.SKIP_VERSION = CS.BF.GameConst.SKIP_VERSION GConst.DESIGN_RESOLUTION_WIDTH = CS.BF.GameConst.DESIGN_RESOLUTION_WIDTH GConst.DESIGN_RESOLUTION_HEIGHT = CS.BF.GameConst.DESIGN_RESOLUTION_HEIGHT GConst.BIG_TEXTURE_WIDTH = CS.BF.GameConst.BIG_TEXTURE_WIDTH GConst.BIG_TEXTURE_HEIGHT = CS.BF.GameConst.BIG_TEXTURE_HEIGHT local width = CS.UnityEngine.Screen.width local height = CS.UnityEngine.Screen.height if width / height <= GConst.DESIGN_RESOLUTION_WIDTH / GConst.DESIGN_RESOLUTION_HEIGHT then height = height * (GConst.DESIGN_RESOLUTION_WIDTH / width) width = GConst.DESIGN_RESOLUTION_WIDTH else width = width * (GConst.DESIGN_RESOLUTION_HEIGHT / height) height = GConst.DESIGN_RESOLUTION_HEIGHT end GConst.UI_SCREEN_WIDTH = width GConst.UI_SCREEN_HEIGHT = height GConst.WAIT_NET_RSP_TIME = 5 -- 与服务器交互的等待回复时间 GConst.INVALID = -1 GConst.DEPTH_BUFFER = 24 GConst.EMPTY_STRING = "" GConst.EMPTY_TABLE = {} setmetatable(GConst.EMPTY_TABLE, { __newindex = function(_, name, value) Logger.logError("can't set GConst.EMPTY_TABLE value") end }) -- c# 组件 GConst.TYPEOF_UNITY_CLASS = { OBJECT = typeof(CS.UnityEngine.Object), GAME_OBJECT = typeof(CS.UnityEngine.GameObject), CAMERA = typeof(CS.UnityEngine.Camera), CANVAS = typeof(CS.UnityEngine.Canvas), CANVAS_GROUP = typeof(CS.UnityEngine.CanvasGroup), GRAPHIC_RAYCASTER = typeof(CS.UnityEngine.UI.GraphicRaycaster), TRANSFORM = typeof(CS.UnityEngine.Transform), RECTTRANSFORM = typeof(CS.UnityEngine.RectTransform), UI_MASKABLE_GRAPHIC = typeof(CS.UnityEngine.UI.MaskableGraphic), UI_IMAGE = typeof(CS.UnityEngine.UI.Image), UI_RAW_IMAGE = typeof(CS.UnityEngine.UI.RawImage), UI_BUTTON = typeof(CS.UnityEngine.UI.Button), UI_TEXT = typeof(CS.UnityEngine.UI.Text), UI_TEXT_MESH_PRO = typeof(CS.TMPro.TextMeshProUGUI), UI_TEXT_MESH = typeof(CS.TMPro.TextMeshPro), UI_SLIDER = typeof(CS.UnityEngine.UI.Slider), UI_INPUT_FIELD = typeof(CS.UnityEngine.UI.InputField), UI_DROP_DOWN = typeof(CS.UnityEngine.UI.Dropdown), UI_SCROLL_RECT = typeof(CS.UnityEngine.UI.ScrollRect), UI_TEXTMESHPRO_DROP_DOWN = typeof(CS.TMPro.TMP_Dropdown), UI_TOGGLE = typeof(CS.UnityEngine.UI.Toggle), UI_TMP_INPUT_FIELD = typeof(CS.TMPro.TMP_InputField), UI_LAYOUT_ELEMENT = typeof(CS.UnityEngine.UI.LayoutElement), U2D_SPRITE_ATLAS = typeof(CS.UnityEngine.U2D.SpriteAtlas), SKINNED_MESH_RENDERER = typeof(CS.UnityEngine.SkinnedMeshRenderer), MESH_RENDERER = typeof(CS.UnityEngine.MeshRenderer), ANIMATOR = typeof(CS.UnityEngine.Animator), ANIMATION = typeof(CS.UnityEngine.Animation), TEXTURE_2D = typeof(CS.UnityEngine.Texture2D), FONT = typeof(CS.UnityEngine.Font), TMP_FONT_ASSET = typeof(CS.TMPro.TMP_FontAsset), SPRITE_RENDERER = typeof(CS.UnityEngine.SpriteRenderer), LIGHT = typeof(CS.UnityEngine.Light), RIGIDBODY = typeof(CS.UnityEngine.Rigidbody), SPHERE_COLLIDER = typeof(CS.UnityEngine.SphereCollider), TEXT_ASSET = typeof(CS.UnityEngine.TextAsset), LINE_RENDERER = typeof(CS.UnityEngine.LineRenderer), UI_RECT_MASK_2D = typeof(CS.UnityEngine.UI.RectMask2D), -- spine组件 SKELETON_GRAPHIC = typeof(CS.Spine.Unity.SkeletonGraphic), SKELETON_ANIMATION = typeof(CS.Spine.Unity.SkeletonAnimation), SKELETON_DATA_ASSET = typeof(CS.Spine.Unity.SkeletonDataAsset), BONE_FOLLOWER = typeof(CS.Spine.Unity.BoneFollower), BONE_FOLLOWER_GRAPHIC = typeof(CS.Spine.Unity.BoneFollowerGraphic), -- 自定义组件 MONKEY_POST = typeof(CS.MonkeyPost), CLOUD_CONTROL = typeof(CS.CloudControl), BF_UI_HELPER = typeof(CS.BF.UIHelper), BF_BASE_SORTING_ORDER_HELPER = typeof(CS.BF.BaseSortingOrderHelper), BF_PREFAB_HELPER = typeof(CS.BF.PrefabHelper), BF_ATLAS = typeof(CS.BF.Atlas), BF_SIMPLE_ATLAS = typeof(CS.BF.SimpleAtlas), BF_UI_TOUCH_EVENT = typeof(CS.BF.UITouchEvent), BF_UI_DRAG_EVENT = typeof(CS.BF.UIDragEvent), BF_NODE_HELPER = typeof(CS.BF.NodeHelper), BF_CHARACTER_HELPER = typeof(CS.BF.CharacterHelper), BF_WEAPON_HELPER = typeof(CS.BF.WeaponHelper), BF_CHARACTER_SPINE_HELPER = typeof(CS.BF.CharacterSpineHelper), BF_SLIDER = typeof(CS.BF.BFSlider), BF_EFFECT_HELPER = typeof(CS.BF.EffectHelper), BF_SCROLL_RECT = typeof(CS.BF.BFScrollRectBase), BF_UI_COORDINATE_HELPER = typeof(CS.BF.UICoordinateHelper), BF_SKILL_SECTOR_MESH = typeof(CS.BF.SkillSectorMesh), BF_TUTORIAL_CLICKAREA = typeof(CS.BF.TutorialClickArea), BF_CAMERA_HELPER = typeof(CS.BF.CameraHelper), BF_HORIZONTAL_OR_VERTICAL_LAYOUT = typeof(CS.BF.BFHorizontalOrVerticalLayout), BF_SCROLL_RECT_CENTER = typeof(CS.BF.ScrollRectCenterController), BF_SCROLL_RECT_CENTER_CORE = typeof(CS.BF.ScrollRectCenter), BF_GRAPHIC_FLIP = typeof(CS.BF.BFGraphicFlip), BF_SCROLL_RECT_BASE_OLD = typeof(CS.BF.ScrollRectBaseOld), BF_BATTLE_CONTROL_HERO = typeof(CS.BF.BattleControlHero), BF_BATTLE_CONTROL_MONSTER = typeof(CS.BF.BattleControlMonster), BF_BATTLE_CONTROL_WARNING = typeof(CS.BF.BattleControlWarning), BF_UI_ERASER_TEXTURE = typeof(CS.BF.UIEraserTexture), BF_UNITY_SLIDER = typeof(CS.BF.BFUnitySlider), BF_ELIMINATION_TOUCH_EVENT = typeof(CS.BF.EliminationTouchEvent), } -- lua 组件 GConst.TYPEOF_LUA_CLASS = { LUA_COMPONENT = "app/bf/component/lua_component", SCROLL_RECT_BASE = "app/ui/common/scrollrect/scrollrect_base", SCROLL_RECT_CENTER = "app/ui/common/scrollrect/scrollrect_center", SCROLL_RECT_OLD = "app/ui/common/scrollrect/scrollrect_old", BASE_CELL = "app/ui/common/cell/base_cell", -- 引导 TUTORIAL_UI = "app/ui/tutorial/tutorial_ui", -- 资源条 CURRENCY_BAR = "app/ui/currency_bar/currency_bar", CURRENCY_BAR_CELL = "app/ui/currency_bar/cell/currency_cell", -- cell ITEM_CELL = "app/ui/common/cell/item_cell", HERO_CELL = "app/ui/common/cell/hero_cell", REWARD_CELL = "app/ui/common/cell/reward_cell", LARGE_HERO_CELL = "app/ui/common/cell/large_hero_cell", } GConst.ATLAS_PATH = { COMMON = "assets/arts/atlas/ui/common.asset", MAIN = "assets/arts/atlas/ui/main.asset", BATTLE = "assets/arts/atlas/ui/battle.asset", ICON_ITEM = "assets/arts/atlas/icon/item.asset", UI_LOGIN = "assets/arts/atlas/ui/login.asset", ICON_SKILL = "assets/arts/atlas/icon/skill.asset", ICON_HERO = "assets/arts/atlas/icon/hero.asset", ICON_SKILL_ROGUE = "assets/arts/atlas/icon/skill_rogue.asset", ICON_BUFF = "assets/arts/atlas/icon/buff.asset", BOUNTY = "assets/arts/atlas/ui/bounty.asset", UI_SETTING = "assets/arts/atlas/ui/setting.asset", ICON_TASK = "assets/arts/atlas/icon/task.asset", } GConst.TOUCH_EVENT = { DOWN = 1, DRAG = 2, UP_INSIDE = 3, UP_OUTSIDE = 4, DRAG_CANCEL_UP = 5, CANCEL = 6, DRAGUP = 7, -- CellDrag组件专用触摸事件 DRAGDOWN = 8, -- CellDrag组件专用触摸事件 DRAGLEFT = 9, -- CellDrag组件专用触摸事件 DRAGRIGHT = 10, -- CellDrag组件专用触摸事件 BEGIN_DRAG = 11, END_DRAG = 12, } GConst.ELIMINATION_TOUCH_EVENT = { ENTER = 1, DOWN = 2, UP = 3, CANCEL = 4, EXIT = 5, } GConst.TOUCH_TYPE = { UNKNOWN = 0, DEFAULT = 1, CLICK = 2, DRAG_CANEL_UP = 5, CANCEL = 6, } GConst.GAME_OBJECT_TYPE = { DEFAULT = 0, UI_OBJECT = 1, EFFECT_OBJECT = 2, MODEL_OBJECT = 3, CHARACTER_OBJECT = 4, TIMELINE_OBJECT = 5, SPINE_UI_OBJECT = 6, SPINE_MESH_OBJECT = 7, MESSAGEBOX_RECONNECT = 8 } GConst.OBJECT_CUSTOM_DATA = { BATTLE_RECYCLE_TIME = 1 } GConst.CLICK_SOUND = { NONE = 0, NORMAL = 1 } GConst.CURRENCY_TYPE = { HORIZONTAL = 1, VERTICAL = 2, } GConst.DOTWEEN_IDS = { DEFAULT = 0, TOAST = 1, BATTLE = 2, -- 此id和c# BattleConst的id一致,需要同步修改 WAIT_NET = 4, TUTORIAL = 5, TASK_TOAST = 6, BATTLE_UI = 7 } GConst.MESSAGE_BOX_TYPE = { MB_OK = 1, MB_OK_CANCEL = 2, } GConst.MESSAGE_BOX_SHOW_TODAY = { BOUNTY_BUY_LEVEL = 1, } GConst.QUALITY_TYPE = { [1] = "#D1D1D1", [2] = "#A3FF94", [3] = "#4DFFF5", [4] = "#FA79FF", [5] = "#FFEE79", [6] = "#FFAC40", [7] = "#FF5050", } GConst.QUALITY_COLOR = { [1] = CS.UnityEngine.Color.white, [2] = CS.UnityEngine.Color(0.17647, 0.917647, 0.490196, 1.0), [3] = CS.UnityEngine.Color(0.2745098, 0.8509803, 1.0, 1.0), [4] = CS.UnityEngine.Color(0.7686274, 0.3686274, 1.0, 1.0), [5] = CS.UnityEngine.Color(1.0, 0.662745, 0.2, 1.0), [6] = CS.UnityEngine.Color(0, 0.9843137, 1.0, 1.0), [7] = CS.UnityEngine.Color(0.9568627, 0.1921568, 0.3725490, 1.0), } GConst.COLOR = { WHITE = CS.UnityEngine.Color.white, BLUE = CS.UnityEngine.Color(0.2745098, 0.8509803, 1.0, 1.0), PURPLE = CS.UnityEngine.Color(0.7686274, 0.3686274, 1.0, 1.0), ORANGE = CS.UnityEngine.Color(1.0, 0.662745, 0.2, 1.0), YELLOW = CS.UnityEngine.Color(1.0, 0.9333333, 0.1764705, 1.0), YELLOW_TITLE = CS.UnityEngine.Color(1, 0.9294118, 0.7529412, 1.0), YELLOW_2 = CS.UnityEngine.Color(1, 0.9333333, 0.6117647, 1.0), GREEN = CS.UnityEngine.Color(0.17647, 0.917647, 0.490196, 1.0), RED = CS.UnityEngine.Color(0.9568627, 0.1921568, 0.3725490, 1.0), BROWN = CS.UnityEngine.Color(0.5529411, 0.4509803, 0.3960784, 1.0), BROWN_2 = CS.UnityEngine.Color(0.6627451, 0.3764706, 0.1411765, 1.0), BROWN_3 = CS.UnityEngine.Color(0.7333333, 0.6627451, 0.5607843, 1.0), GREY = CS.UnityEngine.Color(0.4901961, 0.4901961, 0.4901961, 1.0), } GConst.COMPONENT_GREY_COLOR = CS.UnityEngine.Color(1, 0, 1, 1) GConst.COLOR_CODE = { YELLOW = "#FFEE79", GREY = "#D1D1D1", ORANGE = "#FFAC40", PURPLE = "#FA79FF", BLUE = "#4DFFF5", GREEN = "#A3FF94", RED = "#FF5050", WHITE = "#FFFFFF", } GConst.UI_EFFECT_ORDER = { LEVEL0 = 0, LEVEL1 = 20, LEVEL2 = 40, LEVEL3 = 60, LEVEL4 = 80, LEVEL5 = 100, LEVEL_10 = 10, } GConst.LANGUAGE = { ENGLISH = "en", -- 英文 CHINESE = "cn", -- 简中 FRENCH = "fr", -- 法语 ITALIAN = "it", -- 意语 GERMAN = "de", -- 德语 SPANISH = "es", -- 西语 DUTCH = "nl", -- 荷兰语 RUSSIAN = "ru", -- 俄语 KOREAN = "ko", -- 韩语 JAPANESE = "ja", -- 日语 HUNGARY = "hu", -- 匈牙利 PORTUGUESE = "pt", -- 葡萄牙语 ARABIC = "ar", -- 阿拉伯语 CHINESE_TC = "zh", -- 繁中 TURKISH = "tr", -- 土耳其语 THAILAND = "th", -- 泰语 MALAYSIA = "ms", -- 马来语 VIETNAMESE = "vi", -- 越南 INDONESIA = "id", -- 印度尼西亚 } GConst.EVENT_PRIORITY = { LV1 = 1, LV2 = 2, LV3 = 3, LV4 = 4, LV5 = 5, } GConst.QUALITY = { "GRAY", "GREEN", "BLUE", "PURPLE", "ORANGE", "CYAN", "RED", } GConst.HERO_FRAME = { DEFAULT = "frame_1", GRAY = "frame_1", GREEN = "frame_2", BLUE = "frame_3", PURPLE = "frame_4", ORANGE = "frame_5", CYAN = "frame_6", RED = "frame_7", } GConst.FRAME_QLT = { [1] = "frame_1", [2] = "frame_2", [3] = "frame_3", [4] = "frame_4", [5] = "frame_5", [6] = "frame_6", [7] = "frame_7", } GConst.HERO_SMALL_FRAME_QLT = { [1] = "frame_small_1", [2] = "frame_small_2", [3] = "frame_small_3", [4] = "frame_small_4", [5] = "frame_small_5", [6] = "frame_small_6", [7] = "frame_small_7", } GConst.HERO_FRAME_GRAY_QLT = { [1] = "frame_gray_1", [2] = "frame_gray_2", [3] = "frame_gray_3", [4] = "frame_gray_4", [5] = "frame_gray_5", [6] = "frame_gray_6", [7] = "frame_gray_7", } GConst.QLT_LABLE = { DEFAULT = "equip_quality_1", GRAY = "equip_quality_1", GREEN = "equip_quality_2", BLUE = "equip_quality_3", PURPLE = "equip_quality_4", ORANGE = "equip_quality_5", CYAN = "frame_6", RED = "equip_quality_7", } GConst.ENTITY_TYPE = { ITEM_ENTITY = 1, EQUIP_ENTITY = 2, JEWELRY_ENTITY = 3, } GConst.MATCH_ATTACK_NAME = { [0] = "atk", [1] = "atk_red", [2] = "atk_yellow", [3] = "atk_green", [4] = "atk_blue", [5] = "atk_purple", } GConst.ATTR_TYPE = { hp = 1, atk_red = 2, atk_yellow = 3, atk_green = 4, atk_blue = 5, atk_purple = 6 } GConst.GAMEOBJECT_LAYER = { DEFAULT = CS.BF.Utils.NameToLayer("Default"), UI = CS.BF.Utils.NameToLayer("UI"), UIMODEL = CS.BF.Utils.NameToLayer("UIModel") } GConst.REWARD_TYPE = { REWARD_NONE = 0, ITEM = 1, EQUIP = 2, HERO = 3, LEGACY = 4, RUNES = 5, } GConst.INT_TO_STRING = { [0] = "0", [1] = "1", [2] = "2", [3] = "3", [4] = "4", [5] = "5", [6] = "6", [7] = "7", [8] = "8", [9] = "9", [10] = "10", [11] = "11", [12] = "12", [13] = "13", [14] = "14", [15] = "15", [16] = "16", [17] = "17", [18] = "18", [19] = "19", [20] = "20", [21] = "21", [22] = "22", [23] = "23", [24] = "24", [25] = "25", [26] = "26", [27] = "27", [28] = "28", [29] = "29", [30] = "30", [31] = "31", [32] = "32", [33] = "33", [34] = "34", [35] = "35", [36] = "36", [37] = "37", [38] = "38", [39] = "39", [40] = "40", [41] = "41", [42] = "42", [43] = "43", [44] = "44", [45] = "45", [46] = "46", [47] = "47", [48] = "48", [49] = "49", [50] = "50", [51] = "51", [52] = "52", [53] = "53", [54] = "54", [55] = "55", [56] = "56", [57] = "57", [58] = "58", [59] = "59", [60] = "60", [61] = "61", [62] = "62", [63] = "63", [64] = "64", [65] = "65", [66] = "66", [67] = "67", [68] = "68", [69] = "69", [70] = "70", [71] = "71", [72] = "72", [73] = "73", [74] = "74", [75] = "75", [76] = "76", [77] = "77", [78] = "78", [79] = "79", [80] = "80", [81] = "81", [82] = "82", [83] = "83", [84] = "84", [85] = "85", [86] = "86", [87] = "87", [88] = "88", [89] = "89", [90] = "90", [91] = "91", [92] = "92", [93] = "93", [94] = "94", [95] = "95", [96] = "96", [97] = "97", [98] = "98", [99] = "99", [100] = "100", } if CS.BF.Utils.GetDataSecretKey then GConst.SECRET_KEY = CS.BF.Utils.GetDataSecretKey() else GConst.SECRET_KEY = "" end GConst.ERROR_STR = { SUCCESS = "SUCCESS", } return GConst