Ejemplo n.º 1
0
        private bool ChargeDataSet(enumHokyuType type, Mem_ship m_ship)
        {
            enumMaterialCategory key;
            int value;
            int num;
            int fuel;
            int bull;

            switch (type)
            {
            case enumHokyuType.Fuel:
            {
                key = enumMaterialCategory.Fuel;
                int bull_max = Mst_DataManager.Instance.Mst_ship[m_ship.Ship_id].Fuel_max;
                value = Comm_UserDatas.Instance.User_material[key].Value;
                num   = m_ship.GetRequireChargeFuel();
                fuel  = bull_max;
                bull  = m_ship.Bull;
                break;
            }

            case enumHokyuType.Bull:
            {
                key = enumMaterialCategory.Bull;
                int bull_max = Mst_DataManager.Instance.Mst_ship[m_ship.Ship_id].Bull_max;
                value = Comm_UserDatas.Instance.User_material[key].Value;
                num   = m_ship.GetRequireChargeBull();
                fuel  = m_ship.Fuel;
                bull  = bull_max;
                break;
            }

            default:
                return(true);
            }
            if (value <= 0)
            {
                return(false);
            }
            if (num == 0)
            {
                return(true);
            }
            if (num > value)
            {
                return(true);
            }
            Comm_UserDatas.Instance.User_material[key].Sub_Material(num);
            m_ship.Set_ChargeData(bull, fuel, null);
            return(true);
        }
Ejemplo n.º 2
0
        private bool ChargeDataSet(Api_req_Hokyu.enumHokyuType type, Mem_ship m_ship)
        {
            enumMaterialCategory enumMaterialCategory;
            int value;
            int num2;
            int fuel;
            int bull;

            if (type == Api_req_Hokyu.enumHokyuType.Fuel)
            {
                enumMaterialCategory = enumMaterialCategory.Fuel;
                int num = Mst_DataManager.Instance.Mst_ship.get_Item(m_ship.Ship_id).Fuel_max;
                value = Comm_UserDatas.Instance.User_material.get_Item(enumMaterialCategory).Value;
                num2  = m_ship.GetRequireChargeFuel();
                fuel  = num;
                bull  = m_ship.Bull;
            }
            else
            {
                if (type != Api_req_Hokyu.enumHokyuType.Bull)
                {
                    return(true);
                }
                enumMaterialCategory = enumMaterialCategory.Bull;
                int num = Mst_DataManager.Instance.Mst_ship.get_Item(m_ship.Ship_id).Bull_max;
                value = Comm_UserDatas.Instance.User_material.get_Item(enumMaterialCategory).Value;
                num2  = m_ship.GetRequireChargeBull();
                fuel  = m_ship.Fuel;
                bull  = num;
            }
            if (value <= 0)
            {
                return(false);
            }
            if (num2 == 0)
            {
                return(true);
            }
            if (num2 > value)
            {
                return(true);
            }
            Comm_UserDatas.Instance.User_material.get_Item(enumMaterialCategory).Sub_Material(num2);
            m_ship.Set_ChargeData(bull, fuel, null);
            return(true);
        }