Beispiel #1
0
 void InitAllRole()
 {
     //创建所有角色
     foreach (var r in ConfigTable.GetAll <Jyx2Role>())
     {
         var role = new RoleInstance(r.Id);
         _instance.AllRoles.Add(role);
     }
 }
Beispiel #2
0
 //打开所有场景
 static public void OpenAllScence()
 {
     foreach (var map in ConfigTable.GetAll <Jyx2Map>())
     {
         runtime.SetSceneEntraceCondition(map.Id, 0);
     }
     runtime.SetSceneEntraceCondition("2", 2);  //云鹤崖
     runtime.SetSceneEntraceCondition("38", 2); //摩天崖
     runtime.SetSceneEntraceCondition("75", 1); //桃花岛
     runtime.SetSceneEntraceCondition("80", 1); //绝情谷底
 }
Beispiel #3
0
 //获得开场地图
 public static GameMap GetGameStartMap()
 {
     foreach (var map in ConfigTable.GetAll <GameMap>())
     {
         if (map.Tags.Contains("START"))
         {
             return(map);
         }
     }
     return(null);
 }
Beispiel #4
0
        public static Item RandomGetByLevel(int level)
        {
            var itemList = ConfigTable.GetAll <Item>().Where(item => { return(item.Level > level - 3 && item.Level < level + 3); }).ToList();

            if (itemList == null || itemList.Count == 0)
            {
                return(null);
            }
            int index = ToolsShared.GetRandomInt(0, itemList.Count - 1);

            return(itemList[level]);
        }
Beispiel #5
0
    void Start()
    {
        skillDropdown.ClearOptions();
        levelDropdown.ClearOptions();

        foreach (var skill in ConfigTable.GetAll <Jyx2Skill>())
        {
            allSkills.Add(skill);
            skills.Add(skill.Name);
        }
        skillDropdown.AddOptions(skills);

        for (int i = 0; i < 10; ++i)
        {
            levels.Add((i + 1).ToString());
        }
        levelDropdown.AddOptions(levels);

        skillDropdown.onValueChanged.AddListener((index) => {
            var skill = allSkills[index];
            //skillDetail.text = skill.SkillEffectCode;
        });
    }
Beispiel #6
0
    private void InitLocationDebugTools()
    {
        //场景快速跳转器
        m_ChangeScene.ClearOptions();
        List <string> activeMaps = new List <string>();

        activeMaps.Add("选择场景");
        foreach (var map in ConfigTable.GetAll <GameMap>())
        {
            if (map.Tags.Contains("BATTLE"))
            {
                continue;
            }
            activeMaps.Add(map.GetShowName());
            m_ChangeSceneMaps.Add(map);
        }
        m_ChangeScene.AddOptions(activeMaps);
        m_ChangeScene.onValueChanged.AddListener(OnChangeScene);

        //地点快速跳转器
        m_TransportDropdown.ClearOptions();
        var triggerObj = GameObject.Find("Level/Triggers");

        if (triggerObj != null)
        {
            List <string> opts = new List <string>();
            opts.Add("传送点");
            for (int i = 0; i < triggerObj.transform.childCount; ++i)
            {
                opts.Add(triggerObj.transform.GetChild(i).name);
            }

            m_TransportDropdown.AddOptions(opts);
            m_TransportDropdown.onValueChanged.AddListener(OnTransport);
        }
    }
Beispiel #7
0
    void OnConfirm()
    {
        string cmd = inputField.text.Trim();

        if (string.IsNullOrEmpty(cmd))
        {
            return;
        }

        string[] paras = cmd.Split(' ');
        switch (paras[0])
        {
        case "map":
        case "scene":
        {
            string id = paras[1];
            foreach (var map in ConfigTable.GetAll <GameMap>())
            {
                if (map.Jyx2MapId == id)
                {
                    //SceneManager.LoadScene(map.Key);
                    LevelLoader.LoadGameMap(map.Key);
                    break;
                }
            }
            break;
        }

        case "event":
        {
            string eventId      = paras[1];
            var    eventLuaPath = "jygame/ka" + eventId;
            Jyx2.LuaExecutor.Execute(eventLuaPath);

            //停止导航
            var levelMaster = LevelMaster.Instance;
            if (levelMaster != null)
            {
                levelMaster.StopPlayerNavigation();
            }
            break;
        }

        case "item":
        {
            int itemId = int.Parse(paras[1]);
            int count  = 1;
            if (paras.Length > 2)
            {
                count = int.Parse(paras[2]);
            }
            Jyx2LuaBridge.AddItem(itemId, count);
            break;
        }

        case "set_attack":
        {
            int attack = int.Parse(paras[1]);
            GameRuntimeData.Instance.Team[0].Attack = attack;
            break;
        }

        case "quickbattle":
        {
            int isOn = int.Parse(paras[1]);
            Jyx2LuaBridge.isQuickBattle = (isOn == 1);
            break;
        }

        //开启无敌
        case "whosyourdad":
        {
            if (paras.Length > 1)
            {
                BattleManager.Whosyourdad = int.Parse(paras[1]) == 1;
            }
            else
            {
                BattleManager.Whosyourdad = true;
            }

            break;
        }

        default:
            Debug.LogError("没有识别的指令,将执行lua替代:" + cmd);
            string luaContent = cmd;
            Jyx2.LuaExecutor.ExecuteLua(luaContent);
            break;
        }
    }