/********************************************************************************
 *	文件名:	GlobeVar.cs
 *	全路径:	\Script\GlobeDefine\GlobeVar.cs
 *	创建人:	李嘉
 *	创建时间:2013-10-25
 *
 *	功能说明:全局变量定义。枚举请定义在GlobeDefine.cs中
 *	修改记录:
*********************************************************************************/

using UnityEngine;

namespace Games.GlobeDefine
{
    public static class GlobeVar
    {
        // 编辑器测试路径
        public static string testConfigPath
        {
            get
            {
                return Application.dataPath.Open("Editor").Open("Config");
            }
        }
        
        //Const 定义
        public const int INVALID_ID = -1; //非法ID
        public const string characTorPath = "";
        public const int MAX_INT_VALUE = 2147483647;
        public const int defaultButtonSound = 7;

        public const int SHOW_PLAYER_NUM_MAX = 30; // 显示其他玩家的最大数目

        public const ulong INVALID_GUID = 0xFFFFFFFFFFFFFFFFul; //非法GUID
        public const ulong SYSFRIEND_GUID = 0; //系统消息
        public const ulong HELPFRIEND_GUID = 1; //小助手消息

        //////////////////////////////////////////////////////////////////////////
        //队伍相关定义
        //////////////////////////////////////////////////////////////////////////
        public const int MAX_TEAM_MEMBER = 5; //队伍最大人数

        public const float MAX_SIGHT_RANGE = 30f; // 最大视野距离,用于子场景动态加载

        public const int MAX_LAST_SPEAKERS = 99; // 聊天框上次发言玩家记录最大数量

        public const int MAX_FRIEND_NUM = 99; // 玩家好友上限
        public const int MAX_BLACK_NUM = 99; // 玩家黑名单上限

        public const int YanMenGuan_QiaoFengAni = 86;
        public const int YanMenGuan_QiaoFengZhenPing = 54;

        public const int YanMenGuan_BossAni = 85;

        public const int YanMenGuan_BeforeQingGongStoryID = 14;
        public const int YanMenGuan_BossStory1ID = 55;
        public const int YanMenGuan_BossStory2ID = 15;

        public const int YanMenGuan_ModelStoryID = 0;
        public const int YanmMenGuan_QingGongID_Over = 2;

        public const int EmotionTiger_Num = 60;

        public const int PosionForgDataID = 44;

        public const int QianLiChuanYinDataID = 4031;

        public const int MAX_FASHION_SIZE = 20;

        public const int MARRY_PARADE_STORY = 60; //游街故事模式

        //GameObject Pool相关
        public const int POOL_MAX_CAPACITY = 256; //GameObject Pool自增长的最大可能长度,超过之后停止自增长并输出错误日志

        //帮会
        public const int CREATE_GUILD_LEVEL = 40; //帮会创建等级
        public const int JOIN_GUILD_LEVEL = 20; //帮会加入等级
        public const int Respond_GUILD_LEVEL = 20; //帮会响应等级
        public const int MAX_GUILD_NAME = 12; //帮会名字长度
        public const int MIN_GUILD_NAME = 2; //帮会名字最小
        public const int MAX_GUILD_NOTICE = 100; //帮会公告长度
        public const int MIN_GUILD_NOTICE = 1; //帮会公告长度最小

        public const int WORLDBOSS_GUIDEMISSIONID = 78;
        public const int WORLDBOSS_GUIDECOPYID = 6047;

        public const int CROSSSERVER_SIGNPOSTSCENE = 590;

        public const int MAIN_SCNENE_ID = 13; //主城场景ID

        //师门入口
        public const int MISSIONINSECTIONSTANDARDENTERID = 500;
        public const int XUANNVANDSHUSHANMASTERAUTOSEARCHID = 9005;
        public const int TIANJIANDCIKEMASTERAUTOSEARCHID = 9006;
        public const int MISSIONINSECTIONENTER1 = 661;
        public const int MISSIONINSECTIONENTER2 = 662;
        public const int MASTERONERONEBASEUID = 2270; //天玑 刺客师门NPC id
        public const int MASTERONERTWOBASEUID = 2271; //蜀山 玄女师门NPC id
        public const int RINGMISSIONENTERFACEID = 900; //跑环入口

        //一条龙入口
        public const int ONEDRAGONENTERID = 400;

        //环任务入口
        public const int RINGMISSIONENTERID = 900;

        //周环任务入口
        public const int WEEKRINGMISSIONENTERID = 1000;

        //宝图入口
        public const int TREASUREMISSIONENTERID = 800;

        public const int DEFAULT_VISUAL_ID = 0; //默认外观ID

        public const int NewButtonEffect = 65;

        //师门
        public const int MAX_MASTER_NAME = 12; //师门名称最大字数 6汉字
        public const int MAX_MASTER_NOTICE = 64; //师门公告最大字数 32汉字
        public const int CREATE_MASTER_LEVEL = 60;
        public const int MAX_MASTER_MEMBER_NUM = 100; //师门最大成员数量
        public const int MAX_MASTER_SKILL_NAME = 12; //师门技能名称最大字数 6汉字

        //体力
        public const int MAX_STAMINA = 100; // 玩家最大体力值基础值
        public const int STAMINA_BUYVALUE = 100; // 玩家每次购买体力值

        //材质变色Material
        public const float BLUEMATERIAL_R = 0.208f;
        public const float BLUEMATERIAL_G = 0.565f;
        public const float BLUEMATERIAL_B = 0.741f;

        //装备
        public const int EQUIP_ENCHANCE_MAX_LEVEL = 60; //强化最大等级

        //门派挑战
        public const int CHALLENGEBATTLESCENEID = 268;

        //结婚特殊技能动作
        public const int MARRY_SKILL_1 = 90103;
        public const int MARRY_SKILL_2 = 90104;
        public const int MARRY_SKILL_3 = 90105;

        //战力区分
        public const int COMBAT_LEVEL_1 = 300000;
        public const int COMBAT_LEVEL_2 = 500000;
        public const int COMBAT_LEVEL_3 = 1000000;
        public const int COMBAT_LEVEL_4 = 2000000;

        public const int COMBAT_LEVEL_5 = 3000000;
        //public const int COMBAT_EFFECT_1 = 169;
        //public const int COMBAT_EFFECT_2 = 170;
        //public const int COMBAT_EFFECT_3 = 171;
        //public const int COMBAT_EFFECT_4 = 241;
        //public const int COMBAT_EFFECT_5 = 242;


        public const int SKILLLEVUPEFFECTID = 193; //技能升级特效

        public const int WuYingXunZongDataID = 59;

        public const int BIND_CHILDREN_MAX = 4;

        //苏州 黑市商人DataID
        public const int BLACKMAKETDATAID_SHUZHOU = 909;

        //洱海 黑市商人DataID
        public const int BLACKMAKETDATAID_ERHAI = 911;

        //苏州 帮会NPC
        public const int GUILDDATAID_SUZHOU = 214;

        //苏州 仓库DataID
        public const int CANGKU1_SHUZHOU = 910;

        //苏州 仓库DataID
        public const int CANGKU2_SHUZHOU = 216;

        public const int USE_AUTOFIGHT_VIPLEVEL = 2;

        //结婚相关NPC
        public const int MARRY_NPCID = 848;
        public const int DIVORCE_NPCID = 849;
        public const int PARADE_NPCID = 933;
        public const int PARADE_BUSID = 934;

        public const int MARRY_RING_ITEMID = 50;

        //伙伴抽取角标提醒开始级别
        public const int PARTNER_GAIN_TIPS_LEVEL = 32;

        //奖励NPC
        public const int AWARD_NPCID = 12;

        //自动强化功能 25级以上可以使用
        public const int MAX_AUTOEQUIT_LIVE = 25;

        //江湖郎中NPC
        public const int RECOVERNPC_DATAID = 996;

        // 跑商任务ID
        public const int PAOSHANG_MISSION = 701;
        public const int PAOSHANG_ACCEPTNPC_DATAID = 210;
        public const int PAOSHANG_MISSIONID_H = 244;
        public const int PAOSHANG_MISSIONID_L = 243;
        public const int TRANSPORT_MISSION = 700; //帮会货运任务

        public const int GUILDMATCH_MAINFUBENID = 38;
        public const int GUILDMATCH_SECONDFUBENID = 39;

        //轻功特效ID
        public const int QINGGONG_EFFECT = 62;

        //个人轻功技能CD
        public const float LIGHT_SKILL_CD = 5.0f;
        public const int LIGHT_SKILL_EFFECT = 240;
        public const int LIGHT_SKILL_TAIL = 243; //轻功拖尾效果

        public const int MAIL_GUILDMAIL_ORIGIN = 40044;

        public const int MOUNT_TIANLONG_ID = 13; // 天龙坐骑ID 动作需要特殊处理

        //跨服场景ID
        public const int CROSSSERVERSCENEID = 590; //跨服押镖场景ID

        // 特殊技能Id
        /// <summary>
        ///     世界地图传送技能id
        /// </summary>
        public const int worldTeleportSkillId = 90101;

        /// <summary>
        ///     副本地图传送技能id
        /// </summary>
        public const int instanceTeleportSkillId = 90102;

        /// <summary>
        ///     冲锋类技能LogicId
        /// </summary>
        public const int chargeSkillLogicId = 3;

        /// <summary>
        ///     闪现类技能LogicId
        /// </summary>
        public const int blinkSkillLogicId = 12;

        /// <summary>
        ///     护盾名称字典id
        /// </summary>
        public const string shieldNameKey = "#{49015}";

        /// <summary>
        ///     护盾颜色字典id
        /// </summary>
        public const string shieldColorKey = "#{49020}";

        public const string grayMaterialName = "UiLuminance";

        //喝酒BUFF
        public const int GuildDrinkBuffid = 978;

        // 特殊场景名称
        public const string sceneLogin = "login";
        public const string sceneLoading = "Loading";

        public const string sceneRole = "DL_X";
        //public const string sceneRoleSubFormat = "Role_{0}";

        // 特殊物体名称
        public const string sceneCameraName = "SceneCameraRoot";

        // 摄像机控制参数
        public const float defaultDpi = 480f; // 默认屏幕Dpi
        public const float pitchPerDpi = 60f; // 垂直旋转速度
        public const float yawPerDpi = 60f; // 水平旋转速度
        public const float distancePerDpi = 5f; // 镜头推进速度
        public const float minPitch = 15f; // 最小仰角
        public const float maxPitch = 60f; // 最大仰角
        public const float minDistance = 5f; // 最小距离
        public const float maxDistance = 20f; // 最大距离

        // 死亡和出生动画
        public const int deathEffectId = 5134;
        public const int bornEffectId = 5135;

        // 主角受击音效
        public const int hitSoundTianJi = 58;
        public const int hitSoundXuanNv = 59;
        public const int hitSoundLiuShan = 60;
        public const int hitSoundShuShan = 61;

        // 帧率限制
        public const int highFrameRate = 60;

        public const int lowFrameRate = 30;

        //Static 定义
        public static bool s_FirstInitGame = true; //第一次进入游戏标示

        //婚宴场景ID
        public static int BANQUETSCENEID = 102;
        public static int BANQUETFUBENID = 6100;
        
        public static int[] GUILD_MAX_MEMBER = {80, 100, 120, 140, 160, 180, 220, 260, 300};

        //帮会成员名字,帮主,副帮主,帮众,预备成员
        public static string[] GUILD_JOB_NAME = {"#{1737}", "#{3307}", "#{3308}", "#{3309}"};

        public static Vector3 INFINITY_FAR = new Vector3(-1000.0f, -1000.0f, -1000.0f);

        //透明色
        public static Color TRANSPARENT_COLOR = new Color(1, 1, 1, 0.005f);

        /// <summary>
        ///     位移类技能LogicId
        /// </summary>
        public static readonly int[] moveSkillLogicIds = {chargeSkillLogicId, blinkSkillLogicId};

        public static bool IsGUIDValid(ulong guid)
        {
            if (guid == INVALID_GUID)
                return false;

            if (guid == 0)
                return false;

            if (guid == HELPFRIEND_GUID)
                return false;

            return true;
        }

        public static uint GetShortGUID(ulong guid)
        {
            var shortGuid = (uint) guid;
            return shortGuid;
        }

        public static int GetGuildMemberMax(int nLevel)
        {
            //由于帮会等级是1-9,但是索引为0-8,所以需要进行-1操作
            nLevel = nLevel - 1;
            if (nLevel >= 0 && nLevel < GUILD_MAX_MEMBER.Length) return GUILD_MAX_MEMBER[nLevel];

            return 0;
        }

        public static int GetMasterAutosearchId(int profession)
        {
            if (profession == 0 || profession == 1)
                return TIANJIANDCIKEMASTERAUTOSEARCHID;
            return XUANNVANDSHUSHANMASTERAUTOSEARCHID;
        }

        public static int GetMasterRolebaseId(int profession)
        {
            if (profession == 0 || profession == 1)
                return MASTERONERONEBASEUID;
            return MASTERONERTWOBASEUID;
        }
    }

    public static class TeamFollowState
    {
        // 未配置
        public const int notSet = -1;

        // 不跟随队长
        public const int notFollow = 0;

        // 跟随队长,正在移动中
        public const int followMove = 1;

        // 跟随队长,正在战斗中
        public const int followCombat = 2;
    }

    public static class FubenAutoType
    {
        // 不自动战斗,解除跟随
        public const int noFollow = -1;

        // 不自动战斗,不解除跟随
        public const int noAuto = 0;

        // 自动战斗,解除跟随
        public const int auto = 1;
    }

    public static class EffectLimitLevel
    {
        public const int common = 0;
        public const int important = 1;
        public const int unlimit = 2;
    }
}

/// <summary>
///     角色身体部位枚举
/// </summary>
public static class ModelPart
{
    public const int invalid = -1; // 占位用,非法部位
    public const int body = 1; // 身体
    public const int weaponLeft = 2; // 左边武器
    public const int weaponRight = 3; // 右边武器
    public const int wing = 4; // 翅膀
    public const int aura = 5; // 特效展示
    public const int mount = 6; // 坐骑
    public const int magic = 7; // 法宝
}