Ejemplo n.º 1
0
    static int GetShootInfo(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 3);
        ShootGameConfig obj  = (ShootGameConfig)LuaScriptMgr.GetNetObjectSelf(L, 1, "ShootGameConfig");
        uint            arg0 = (uint)LuaScriptMgr.GetNumber(L, 2);
        uint            arg1 = (uint)LuaScriptMgr.GetNumber(L, 3);
        ShootGame       o    = obj.GetShootInfo(arg0, arg1);

        LuaScriptMgr.PushObject(L, o);
        return(1);
    }
Ejemplo n.º 2
0
    static int _CreateShootGame(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 0)
        {
            ShootGame obj = new ShootGame();
            LuaScriptMgr.PushObject(L, obj);
            return(1);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: ShootGame.New");
        }

        return(0);
    }
Ejemplo n.º 3
0
    public AttrData GetShootgNPCAttrData(uint id, uint type_id, uint level)
    {
        uint      position  = (uint)GameSystem.Instance.NPCConfigData.GetConfigData(id).position;
        AttrData  attr      = new AttrData();
        ShootGame shootInfo = GetShootInfo(type_id, level);
        uint      basic     = shootInfo.basic;
        float     hedging   = shootInfo.hedging;
        AttrData  npcattr   = GameSystem.Instance.NPCConfigData.TourNpcs.Find(x => x.position == position && x.level == shootInfo.npc_level).attrs;

        attr.attrs["shoot_near"]              = npcattr.attrs["shoot_near"] + basic;
        attr.attrs["shoot_middle"]            = npcattr.attrs["shoot_middle"] + basic;
        attr.attrs["shoot_far"]               = npcattr.attrs["shoot_far"] + basic;
        attr.attrs["dunk_near"]               = npcattr.attrs["dunk_near"] + basic;
        attr.attrs["dunk_middle"]             = npcattr.attrs["dunk_middle"] + basic;
        attr.attrs["layup_near"]              = npcattr.attrs["layup_near"] + basic;
        attr.attrs["layup_middle"]            = npcattr.attrs["layup_middle"] + basic;
        attr.attrs["anti_disturb"]            = (uint)(npcattr.attrs["anti_disturb"] * hedging);
        attr.attrs["pass"]                    = (uint)(npcattr.attrs["pass"] * hedging);
        attr.attrs["control"]                 = (uint)(npcattr.attrs["control"] * hedging);;
        attr.attrs["block"]                   = (uint)(npcattr.attrs["block"] * hedging);
        attr.attrs["anti_block"]              = (uint)(npcattr.attrs["anti_block"] * hedging);
        attr.attrs["steal"]                   = (uint)(npcattr.attrs["steal"] * hedging);
        attr.attrs["disturb"]                 = (uint)(npcattr.attrs["disturb"] * hedging);
        attr.attrs["rebound"]                 = (uint)(npcattr.attrs["rebound"] * hedging);
        attr.attrs["speed"]                   = npcattr.attrs["speed"] + basic;
        attr.attrs["strength"]                = (uint)(npcattr.attrs["strength"] * hedging);
        attr.attrs["interception"]            = (uint)(npcattr.attrs["interception"] * hedging);
        attr.attrs["ph"]                      = npcattr.attrs["ph"] + basic;
        attr.attrs["rebound_height"]          = npcattr.attrs["rebound_height"];
        attr.attrs["cross_speed"]             = npcattr.attrs["cross_speed"];
        attr.attrs["shoot_far_dist"]          = npcattr.attrs["shoot_far_dist"];
        attr.attrs["bodythrowcatch_distance"] = npcattr.attrs["bodythrowcatch_distance"];
        attr.attrs["bodythrowcatch_prob"]     = npcattr.attrs["bodythrowcatch_prob"];

        Debug.Log("shoot_near:" + attr.attrs["shoot_near"]);
        Debug.Log("shoot_middle:" + attr.attrs["shoot_middle"]);
        Debug.Log("anti_disturb:" + attr.attrs["anti_disturb"]);
        Debug.Log("steal:" + attr.attrs["steal"]);
        Debug.Log("rebound:" + attr.attrs["rebound"]);
        Debug.Log("disturb:" + attr.attrs["disturb"]);
        Debug.Log("strength:" + attr.attrs["strength"]);
        return(attr);
    }
Ejemplo n.º 4
0
    static int get_times(IntPtr L)
    {
        object    o   = LuaScriptMgr.GetLuaObject(L, 1);
        ShootGame obj = (ShootGame)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name times");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index times on a nil value");
            }
        }

        LuaScriptMgr.Push(L, obj.times);
        return(1);
    }
Ejemplo n.º 5
0
    static int set_reward_id(IntPtr L)
    {
        object    o   = LuaScriptMgr.GetLuaObject(L, 1);
        ShootGame obj = (ShootGame)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name reward_id");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index reward_id on a nil value");
            }
        }

        obj.reward_id = (uint)LuaScriptMgr.GetNumber(L, 3);
        return(0);
    }
Ejemplo n.º 6
0
    static int set_score_level(IntPtr L)
    {
        object    o   = LuaScriptMgr.GetLuaObject(L, 1);
        ShootGame obj = (ShootGame)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name score_level");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index score_level on a nil value");
            }
        }

        obj.score_level = LuaScriptMgr.GetString(L, 3);
        return(0);
    }
Ejemplo n.º 7
0
    static int set_hedging(IntPtr L)
    {
        object    o   = LuaScriptMgr.GetLuaObject(L, 1);
        ShootGame obj = (ShootGame)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name hedging");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index hedging on a nil value");
            }
        }

        obj.hedging = (float)LuaScriptMgr.GetNumber(L, 3);
        return(0);
    }
Ejemplo n.º 8
0
    public void Read()
    {
        string text = ResourceLoadManager.Instance.GetConfigText(name1);

        if (text == null)
        {
            Debug.LogError("LoadConfig failed: " + name1);
            return;
        }

        shootGame.Clear();

        XmlDocument xmlDoc   = CommonFunction.LoadXmlConfig(GlobalConst.DIR_XML_SHOOT_GAME, text);
        XmlNodeList nodelist = xmlDoc.SelectSingleNode("Data").ChildNodes;

        foreach (XmlElement xe in nodelist)
        {
            XmlNode comment = xe.SelectSingleNode(GlobalConst.CONFIG_SWITCH_COLUMN);
            if (comment != null && comment.InnerText == GlobalConst.CONFIG_SWITCH)
            {
                continue;
            }
            ShootGame shoot_game = new ShootGame();
            foreach (XmlElement xel in xe)
            {
                if (xel.Name == "id")
                {
                    uint.TryParse(xel.InnerText, out shoot_game.id);
                }
                else if (xel.Name == "times")
                {
                    uint.TryParse(xel.InnerText, out shoot_game.times);
                }
                else if (xel.Name == "level_region")
                {
                    string[] temp = xel.InnerText.Split(',');
                    shoot_game.level_low  = uint.Parse(temp[0]);
                    shoot_game.level_high = uint.Parse(temp[1]);
                }
                else if (xel.Name == "npc_level")
                {
                    uint.TryParse(xel.InnerText, out shoot_game.npc_level);
                }
                else if (xel.Name == "modified_factor")
                {
                    string[] temp = xel.InnerText.Split('&');
                    shoot_game.basic   = uint.Parse(temp[0]);
                    shoot_game.hedging = float.Parse(temp[1]);
                }
                else if (xel.Name == "game_mode")
                {
                    uint.TryParse(xel.InnerText, out shoot_game.game_mode_id);
                }
                else if (xel.Name == "score_level")
                {
                    shoot_game.score_level = xel.InnerText;
                }
                else if (xel.Name == "rewards_num")
                {
                    shoot_game.rewards_num = xel.InnerText;
                }
                else if (xel.Name == "rewards_id")
                {
                    uint.TryParse(xel.InnerText, out shoot_game.reward_id);
                }
            }
            shootGame.Add(shoot_game);
        }
    }