import { v3 } from "cc";
import { JNLayerAnim, JNLayerAnimInfo, JNLayerInfo } from "../../../extensions/ngame/assets/ngame/ui/JNLayer";

export enum GLayer{
    View = "View",
    Popup = "Popup",
    Tips = "Tips",
}

export enum GUI{
    /** 系统UI */
    Login = "Login",                        //登录页面
    Loading = "Loading",                    //加载页面
    Tips = "Tips",                          //提示
    SelectionBox = "SelectionBox",          //选择提示页面 (用于玩家确定该操作)
    Debugger = "Debugger",                  //Debugger
    RewardClaimView = "RewardClaimView",    //奖励领取通用界面

    /** 新手引导 */
    NoviceNamingView = "NoviceNamingView", //新手引导页面 - 取名
    NoviceSelectPetView = "NoviceSelectPetView", //新手引导页面 - 选择宠物

    /** 主页页面 */
    MainChat = "MainChat", //主页聊天页面
    IntoBattleView = "IntoBattleView", //上阵页面
    MainOnHookView = "MainOnHookView",  //挂机弹窗
    MapSelectView = "MapSelectView",    //地图选择页面
    PacksackView = "PacksackView",      //背包页面
    ShopView = "ShopView",              //商店页面

    /** 副本 */
    DungeonView = "DungeonView",    //副本页面


    /**宠物 */
    PetUpStarView = "PetUpStarView",    //宠物升星页面
    PetRadioView = "PetRadioView",    //宠物单选页面
    PetEquipForgingPopupView = "PetEquipForgingPopupView",  //弹出锻造宠物装备页面
    PetEquipView = "PetEquipView",  //宠物装备页面


    /**游戏模式页面 */
    PVPModeMatchView = "PVPModeMatchView", //PVP模式匹配页面
    CampGuardianView = "CampGuardianView", //阵营守护战斗页面
    OnHookRinkingView = "OnHookRinkingView", //OnHook 排行榜页面

    Home = "Home",                      //主页面
    Main = "Main",                      //主页面2
    ServerMain = "ServerMain",          //服务器主页
}


//常用动画
const BackOutScale:JNLayerAnimInfo = {
    front:JNLayerAnim.BackOutOpen,
    back:JNLayerAnim.BackInClose
}
const BackOutMove:JNLayerAnimInfo = {
    front:JNLayerAnim.Enlarge,
    back:JNLayerAnim.Smaller,
    frontInfo:{key:"position",start:v3(1280,0,0),end:v3(0,0,0)},
    backInfo:{key:"position",start:v3(0,0,0),end:v3(1280,0,0)}
}


//系统UI
const UISystemConfig:{ [key: string]: JNLayerInfo; } = {
    [GUI.Tips]:{
        layer:GLayer.Tips,
        uri: "prefab/ui/系统页面/提示/TipsView",
        anims:{
            front:JNLayerAnim.Enlarge,
            back:JNLayerAnim.Smaller,
            frontInfo:{key:"position",start:v3(720,0,0),end:v3(0,0,0)},
            backInfo:{key:"position",start:v3(0,0,0),end:v3(720,0,0)}
        }
    },
    [GUI.Debugger]:{
        layer:GLayer.Popup,
        uri: "prefab/ui/Debugger/Debugger",
        anims:BackOutScale
    },
    [GUI.SelectionBox]:{
        layer:GLayer.Tips, 
        uri: "prefab/ui/系统页面/选择提示/SelectionBox",
        anims:BackOutScale,
    },
    [GUI.Login]:{
        layer:GLayer.Popup,
        uri: "prefab/ui/系统页面/LoginView",
        anims:BackOutScale
    },
    [GUI.Loading]:{
        layer:GLayer.View, 
        uri: "prefab/ui/加载页面/LoadingView",
        anims:{
            back:JNLayerAnim.Smaller,
            backInfo:{key:"position",start:v3(0,0,0),end:v3(-720,0,0)}
        },
    },
    [GUI.RewardClaimView]:{
        layer:GLayer.Popup, 
        uri: "prefab/ui/常用预制体/奖励/领取奖励页面",
        anims:BackOutScale
    },
}

//主页UI
const UIMainConfig:{ [key: string]: JNLayerInfo; } = {
    [GUI.MainChat]:{
        layer:GLayer.Popup,
        uri: "prefab/ui/主页/聊天/MainChatView",
        anims:BackOutMove
    },
    [GUI.IntoBattleView]:{
        layer:GLayer.Popup,
        uri: "prefab/ui/阵法/阵法选择页面",
        anims:BackOutScale,
    },
    [GUI.MainOnHookView]:{
        layer:GLayer.Popup,
        uri: "prefab/ui/主页/挂机/主页挂机页面",
        anims:BackOutScale,
    },
    [GUI.MapSelectView]:{
        layer:GLayer.Popup,
        uri: "prefab/ui/地图/地图选择页面",
        anims:BackOutScale,
    },
    [GUI.PacksackView]:{
        layer:GLayer.Popup,
        uri: "prefab/ui/资源/资源背包页面",
        anims:BackOutScale,
    },
    [GUI.ShopView]:{
        layer:GLayer.Popup,
        uri: "prefab/ui/商店/商店页面",
        anims:BackOutMove,
    },
}

//宠物页面
const UIPetConfig:{ [key: string]: JNLayerInfo; } = {
    [GUI.PetUpStarView]:{
        layer:GLayer.Popup,
        uri: "prefab/ui/宠物/宠物升星页面",
        anims:BackOutScale,
    },
    [GUI.PetRadioView]:{
        layer:GLayer.Popup,
        uri: "prefab/ui/宠物/宠物单选页面",
        anims:BackOutScale,
    },
    [GUI.PetEquipForgingPopupView]:{
        layer:GLayer.Popup,
        uri: "prefab/ui/宠物装备/弹出锻造装备页面",
        anims:BackOutScale,
    },
    [GUI.PetEquipView]:{
        layer:GLayer.Popup,
        uri: "prefab/ui/宠物装备/宠物装备背包页面",
        anims:BackOutScale,
    },
}


//新手引导页面
const UINoviceConfig:{ [key: string]: JNLayerInfo; } = {

    [GUI.NoviceNamingView]:{
        layer:GLayer.Popup,
        uri: "prefab/ui/新手引导页面/NoviceNamingView",
        anims:BackOutScale
    },
    [GUI.NoviceSelectPetView]:{
        layer:GLayer.Popup,
        uri: "prefab/ui/新手引导页面/NoviceSelectPetView",
        anims:BackOutScale
    },

}

//副本页面
const UIDungeonConfig:{ [key: string]: JNLayerInfo; } = {
    [GUI.DungeonView]:{
        layer:GLayer.Popup,
        uri: "prefab/ui/副本页面/副本页面",
        anims:BackOutScale
    }
}

//游戏模式页面
const UIGModeConfig:{ [key: string]: JNLayerInfo; } = {

    [GUI.PVPModeMatchView]:{
        layer:GLayer.Popup,
        uri: "prefab/ui/模式/PVP/PVP匹配页面",
        anims:BackOutScale
    },
    [GUI.CampGuardianView]:{
        layer:GLayer.Popup,
        uri: "prefab/ui/模式/CampGuardian/阵营守护战斗页面",
        anims:BackOutScale
    },
    [GUI.OnHookRinkingView]:{
        layer:GLayer.Popup,
        uri: "prefab/ui/模式/OnHook/OnHook排行榜",
        anims:{
            front:JNLayerAnim.Enlarge,
            back:JNLayerAnim.Smaller,
            frontInfo:{key:"position",start:v3(1280,0,0),end:v3(0,0,0)},
            backInfo:{key:"position",start:v3(0,0,0),end:v3(1280,0,0)}
        }
    },

}

export const UIConfig:{ [key: string]: JNLayerInfo; } = {
    [GUI.Home]:{
        layer:GLayer.View,
        uri: "prefab/ui/主页/HomeView",
        anims:{
            front:JNLayerAnim.Enlarge,
            back:JNLayerAnim.Smaller,
            frontInfo:{key:"position",start:v3(720,0,0),end:v3(0,0,0)},
            backInfo:{key:"position",start:v3(0,0,0),end:v3(-720,0,0)}
        },
    },
    [GUI.Main]:{
        layer:GLayer.View,
        uri: "prefab/ui/主页/MainView",
        anims:{
            front:JNLayerAnim.Enlarge,
            back:JNLayerAnim.Smaller,
            frontInfo:{key:"position",start:v3(720,0,0),end:v3(0,0,0)},
            backInfo:{key:"position",start:v3(0,0,0),end:v3(-720,0,0)}
        },
    },
    [GUI.ServerMain]:{
        layer:GLayer.View,
        uri: "prefab/ui/主页/ServerMainView",
        anims:{
            front:JNLayerAnim.Enlarge,
            back:JNLayerAnim.Smaller,
            frontInfo:{key:"position",start:v3(720,0,0),end:v3(0,0,0)},
            backInfo:{key:"position",start:v3(0,0,0),end:v3(-720,0,0)}
        },
    },
    ...UISystemConfig, //系统页面
    ...UINoviceConfig, //新手引导页面
    ...UIMainConfig, //主页面
    ...UIPetConfig,  //宠物页面
    ...UIDungeonConfig, //副本页面
    ...UIGModeConfig, //游戏模式页面
}