Esempio n. 1
0
        // -------------------------------------------------------------------
        // Protected
        // -------------------------------------------------------------------
        protected override void InitializeGameComponents()
        {
            GameRuntimeData.InstantiateAndInitialize();

            AudioSystem.InstantiateAndInitialize();

            GameModules.InstantiateAndInitialize();
        }
Esempio n. 2
0
 // -------------------------------------------------------------------
 // Public
 // -------------------------------------------------------------------
 public void Configure()
 {
     GameRuntimeData.RegisterData <RuntimeAudioData>();
     GameRuntimeData.RegisterData <RuntimeRarityData>();
     GameRuntimeData.RegisterData <RuntimeTagData>();
     GameRuntimeData.RegisterData <RuntimeFactionData>();
     GameRuntimeData.RegisterData <RuntimeClassData>();
     GameRuntimeData.RegisterData <RuntimeRaceData>();
 }
Esempio n. 3
0
    void OnNewGame()
    {
        int index   = 999;
        var runtime = GameRuntimeData.Create(index);

        //默认创建主角
        var player = new RoleInstance()
        {
            Name      = "小虾米",
            Key       = "主角",
            HeadAvata = "0",
        };

        player.BindKey();
        runtime.Team.Add(player);
        runtime.MapRuntimeData.Clear();

        //m_PlayableDirector.Stop();
        //Camera.main.transform.position = new Vector3(2f, 1.2f, 0);
        //Camera.main.transform.rotation = Quaternion.Euler(new Vector3(2f, -45f, 0));
        //this.gameObject.SetActive(false);
        //m_HeadAvataPanel.gameObject.SetActive(true);
        //SceneManager.LoadScene("BuildRole");

        //开场地图
        var startMap = GameMap.GetGameStartMap();

        runtime.CurrentMap = startMap.Key;

        runtime.CurrentPos = "";

        //var loadPara = new LevelMaster.LevelLoadPara();
        //loadPara.loadType = LevelMaster.LevelLoadPara.LevelLoadType.StartAtTrigger;
        //loadPara.triggerName = "Level/Triggers/0";

        ////加载地图
        //LevelLoader.LoadGameMap(startMap, loadPara, "", () =>
        //{
        //    //首次进入游戏音乐
        //    AudioManager.PlayMusic(16);
        //});
        m_middleBtns.gameObject.SetActive(false);
        m_inputName.gameObject.SetActive(true);
    }
Esempio n. 4
0
    public static void DoLoadGame(int index)
    {
        //加载存档
        var r = GameRuntimeData.LoadArchive(index);

        //初始化角色
        foreach (var role in r.Team)
        {
            role.BindKey();
        }

        var loadPara = new LevelMaster.LevelLoadPara()
        {
            loadType = LevelMaster.LevelLoadPara.LevelLoadType.Load
        };

        //加载地图
        LevelLoader.LoadGameMap(r.CurrentMap, loadPara);
    }
Esempio n. 5
0
    async private void Start()
    {
        await BeforeSceneLoad.loadFinishTask;

        if (GameRuntimeData.Instance == null)
        {
            GameRuntimeData.CreateNew();
        }

        //设置所有的宝箱
        foreach (var chest in GameObject.FindObjectsOfType <MapChest>())
        {
            chest.Init();
        }


        //设置所有的场景变更
        RefreshSceneObjects();


        //if (m_RuntimeDataSimulate && GameRuntimeData.Instance == null)
        //{
        //    var runtime = GameRuntimeData.CreateNew();
        //    var playerRoleView = RoleHelper.FindPlayer();
        //    playerRoleView.BindRoleInstance(runtime.Player);

        //    //测试队友
        //    //foreach (var teammate in m_TestTeammate)
        //    //{
        //    //    var role = RoleHelper.CreateRoleInstance(teammate);
        //    //    runtime.Team.Add(role);
        //    //    MapRuntimeData.Instance.AddToExploreTeam(role);
        //    //}

        //    //随机增加物品
        //    //for(int i = 0; i < 5; ++i)
        //    //{
        //    //    runtime.AddItem(UnityEngine.Random.Range(0, 197), UnityEngine.Random.Range(1, 10));
        //    //}

        //    //测试物品
        //    //List<string> itemList = new List<string>() {
        //    //    "皮甲", "皮手套", "生锈的宝剑", "凤凰琴", "桃花华裳", "杨家宝刀",
        //    //    "杨家宝甲", "林冲虎啸枪", "摇光", "摇光剑", "摇光枪", "摇光拳套",
        //    //    "寒铁宝甲", "老成皮甲", "名剑白虹", "昆吾神剑", "青莲古衣", "道济古帽",
        //    //    "道济葫芦", "朔雪头冠", "朔雪飞靴", "大内金靴", "大内头冠", "星移长衣",
        //    //    "星移斗笠", "香神链", "蔓陀长靴", "蔓陀束带", "飞流饰带", "四象饰带",
        //    //    "吟龙带", "吟龙履", "南山守则", "阴阳幡", "天道束腰", "任侠环"
        //    //};

        //    //foreach (var item in itemList)
        //    //{
        //    //    runtime.AddItem(ItemInstance.Generate(item, true));
        //    //}

        //    //探索技能值
        //    //MapRuntimeData.Instance.ExploreSkillPoint = 100;
        //}
        //场景准备完成 显示主界面
        Jyx2_UIManager.Instance.ShowMainUI();
    }
Esempio n. 6
0
    // Use this for initialization
    async void Start()
    {
        if (RuntimeDataSimulate && runtime == null)
        {
            //测试存档位
            var r = GameRuntimeData.CreateNew();  //选一个没有用过的id
            MapRuntimeData.Instance.Clear();
        }

        var brain = Camera.main.GetComponent <CinemachineBrain>();

        if (brain != null)
        {
            brain.m_DefaultBlend = new CinemachineBlendDefinition(CinemachineBlendDefinition.Style.Cut, 0);
        }

        //m_BattleHelper = GetComponent<BattleHelper>();
        //m_MobileRotateSlider.SetActive(Application.isMobilePlatform);

        //播放音乐
        var gameMap = GetCurrentGameMap();

        if (gameMap != null)
        {
            if (gameMap.Tags.Contains("WORLDMAP"))//JYX2 临时测试
            {
                var btn = transform.Find("UI/MainUI/BackButton");
                if (btn != null)
                {
                    btn.gameObject.SetActive(false);
                }
            }

            //播放音乐
            PlayMusic(gameMap);

            if (gameMap.Tags.Contains("BIGMAP"))
            {
                m_CurrentType = MapType.BigMap;
            }
            else
            {
                //显示当前地图名,大地图不用显示
                //StoryEngine.Instance.middleTopMessageSuggestPanel.Show(gameMap.GetShowName());
                Jyx2_UIManager.Instance.ShowUI("CommonTipsUIPanel", TipsType.MiddleTop, gameMap.GetShowName());
            }

            if (string.IsNullOrEmpty(runtime.CurrentMap))
            {
                runtime.CurrentMap = gameMap.Key;
            }
        }

        //搜索地图中所有MapRole,并绑定数据实例
        //foreach (var r in FindAllMapRole())
        //{
        //    if (string.IsNullOrEmpty(r.m_RoleKey))
        //        continue;

        //    if (r.DataInstance == null) r.CreateRoleInstance(r.m_RoleKey);
        //    if (!r.gameObject.activeInHierarchy) r.m_IsWaitingForActive = false;

        //    r.RefreshModel();
        //}

        navPointer = Instantiate(navPointerPrefab);
        navPointer.SetActive(false);

        //刷新界面控制器
        UpdateMobileControllerUI();

        GraphicSetting.GlobalSetting.Execute();


        //尝试绑定主角
        TryBindPlayer();


        //刷新游戏事件
        RefreshGameEvents();
    }
Esempio n. 7
0
    //void OnTest()
    //{
    //    m_Roles = new List<BattlePosRole>();
    //    m_Roles.Add(new BattlePosRole() { pos = "1", team = 0, roleKey = "0" });
    //    m_Roles.Add(new BattlePosRole() { pos = "2", team = 1, roleKey = "1" });
    //    m_Roles.Add(new BattlePosRole() { pos = "1", team = 1, roleKey = "3" });
    //    m_Roles.Add(new BattlePosRole() { pos = "1", team = 1, roleKey = "4" });
    //    m_Roles.Add(new BattlePosRole() { pos = "2", team = 0, roleKey = "5" });
    //    m_Roles.Add(new BattlePosRole() { pos = "2", team = 0, roleKey = "51" });

    //    GameRuntimeData.CreateNew();  //选一个没有用过的id
    //    MapRuntimeData.Instance.Clear();


    //    //测试等级
    //    runtime.TeamLevel = 10;

    //    InitBattle(null);
    //}


    void LoadJyx2Battle(int id, Action <BattleResult> callback)
    {
        Debug.Log("-----------BattleLoader.LoadJyx2Battle");
        if (GameRuntimeData.Instance == null)
        {
            GameRuntimeData.CreateNew();
        }


#if JYX2_TEST
        //临时用于测试
        var player = runtime.Team[0];
        player.MaxHp      = 999;
        player.MaxMp      = 999;
        player.Zuoyouhubo = 1;
        player.Qinggong   = 100;

        player.Attack = 50;
        player.Recover();

        runtime.AddItem(3, 100);//小还丹
#endif


        m_Roles = new List <BattlePosRole>();
        Jyx2Battle battle = ConfigTable.Get <Jyx2Battle>(id);
        if (battle == null)
        {
            Debug.LogError("载入了未定义的战斗,id=" + id);
            return;
        }

        AudioManager.PlayMusic(battle.Music);

        //设置了自动战斗人物
        if (battle.HasAutoTeamMates())
        {
            foreach (var v in battle.AutoTeamMates)
            {
                var roleId = v.Value;
                if (roleId == -1)
                {
                    continue;
                }
                AddRole(roleId, 0); //TODO IS AUTO
            }
            LoadJyx2BattleStep2(battle, null, callback);
        }
        else //否则让玩家选择
        {
            //必选人物
            Func <RoleInstance, bool> mustRoleFunc = (r) => {
                return(battle.TeamMates.Exists(t => t.Value.ToString() == r.Key));
            };

            //弹出选择人物面板
            //Jyx2RoleSelector.Create(runtime.Team, mustRoleFunc, (selectRoles) => {
            //    LoadJyx2BattleStep2(battle, selectRoles, callback);
            //});
            SelectRoleParams selectPram = new SelectRoleParams();
            selectPram.roleList   = runtime.Team;
            selectPram.mustSelect = mustRoleFunc;
            selectPram.title      = "选择上场角色";
            selectPram.maxCount   = 5;//TODO 最大上场人数
            selectPram.canCancel  = false;
            selectPram.callback   = (cb) =>
            {
                LoadJyx2BattleStep2(battle, cb.selectList, callback);
            };
            Jyx2_UIManager.Instance.ShowUI("SelectRolePanel", selectPram);
        }
    }