Exemple #1
0
    public void Initialize(NDictionary args)
    {
        SanctuaryPackage sanctuaryPackage = FacadeSingleton.Instance.RetrieveData(ConstVal.Package_Sanctuary) as SanctuaryPackage;
        int      configID = args.Value <int>("id");
        bool     isUnlock = args.Value <bool>("isunlock");
        UILabel  label    = transform.Find("label").GetComponent <UILabel>();
        BUILDING config   = ConfigDataStatic.GetConfigDataTable("BUILDING")[configID] as BUILDING;

        if (isUnlock == true)
        {
            label.text = string.Format("{0} Lv.{1}", config.BldgName, sanctuaryPackage.GetBulidingLevelByConfigID(configID));
        }
        else
        {
            UserPackage userPackage  = FacadeSingleton.Instance.RetrieveData(ConstVal.Package_User) as UserPackage;
            int         curLevel     = userPackage.GetManorLevel();
            int         requireLevel = config.BldgLvLim;
            if (curLevel >= requireLevel)
            {
                label.text = string.Format("[90FF15]可解锁[-]");
            }
            else
            {
                label.text = string.Format("庄园Lv.{0} 解锁", requireLevel);
            }
        }
        name = config.BldgName;
    }
Exemple #2
0
    public int GetPlayerLevel(out float progress)
    {
        var levelMap = ConfigDataStatic.GetConfigDataTable("PLAYER_LEVEL");
        int i        = 0;

        for (i = 1; i <= 20; i++)
        {
            PLAYER_LEVEL data = levelMap[i] as PLAYER_LEVEL;
            if (personContribution < data.PlayerCap)
            {
                if (i == 1)
                {
                    progress = (float)personContribution / (float)data.PlayerCap;
                }
                else
                {
                    PLAYER_LEVEL preData = levelMap[i - 1] as PLAYER_LEVEL;
                    progress = (float)(personContribution - preData.PlayerCap) / (float)(data.PlayerCap - preData.PlayerCap);
                }
                return(i);
            }
        }
        progress = 1.0f;
        return(20);
    }
Exemple #3
0
    public List <NItemInfo> GetBuildingUpgradeCost(NDictionary args)
    {
        if (args == null)
        {
            return(null);
        }
        int fromConfigID = args.Value <int>("configID");
        List <NItemInfo> costInfoList  = new List <NItemInfo>();
        var      buildingConfigDataMap = ConfigDataStatic.GetConfigDataTable("BUILDING");
        BUILDING buildingConfigData    = buildingConfigDataMap[fromConfigID] as BUILDING;

        for (int i = 0; i < buildingConfigData.CostTableCount; i++)
        {
            var costData = buildingConfigData.GetCostTable(i);
            int configID = costData.CostId;
            if (configID == 0)
            {
                continue;
            }
            int       number = costData.CostQty;
            NItemInfo info   = new NItemInfo();
            info.configID = configID;
            info.number   = number;
            costInfoList.Add(info);
        }
        return(costInfoList);
    }
Exemple #4
0
    public int GetManorLevel(out float progress)
    {
        var levelMap = ConfigDataStatic.GetConfigDataTable("MANOR_LEVEL");
        int i        = 1;

        for (i = 1; i <= 20; i++)
        {
            MANOR_LEVEL data = levelMap[i] as MANOR_LEVEL;
            if (totalContribution < data.ManorCap)
            {
                if (i == 1)
                {
                    progress = (float)totalContribution / (float)data.ManorCap;
                }
                else
                {
                    MANOR_LEVEL preData = levelMap[i - 1] as MANOR_LEVEL;
                    progress = (float)(totalContribution - preData.ManorCap) / (float)(data.ManorCap - preData.ManorCap);
                }
                progress = 1 - progress;
                return(i);
            }
        }
        progress = 1.0f;
        return(20);
    }
    public override void DrawCell(int index, int count = 0)
    {
        base.DrawCell(index, count);
        var dataList = dynamicPackage.GetVisibleEventList();

        if (index >= dataList.Count)
        {
            return;
        }
        NWorldEventInfo info = dataList[index];

        var          configMap = ConfigDataStatic.GetConfigDataTable("WORLD_EVENTS");
        WORLD_EVENTS config    = configMap[info.configID] as WORLD_EVENTS;

        titleLabel.text   = config.EventName;
        contentLabel.text = config.EventNews;
        endTime           = info.happenTime + config.EventDuration * 60 * 1000;
        //print(string.Format("{0}, {1}, {2}", config.EventName, GlobalFunction.DateFormat(info.happenTime), GlobalFunction.DateFormat(endTime)));
        if (GlobalFunction.IsHappened(info.happenTime))
        {
            ShowTime(endTime, true);
        }
        else
        {
            ShowTime(info.happenTime, false);
        }
    }
    void InitView()
    {
        NBuildingInfo info            = sanctuarytPackage.GetBuildingInfo(selecttionBuilding.BuildingID);
        var           buildingDataMap = ConfigDataStatic.GetConfigDataTable("BUILDING");
        BUILDING      buildingData    = buildingDataMap[info.configID] as BUILDING;
        int           level           = sanctuarytPackage.GetBulidingLevelByConfigID(info.configID);

        titleLabel.text   = string.Format("{0} Lv.{1}", buildingData.BldgName, level);
        contentLable.text = buildingData.BldgInfo;
        //render 3d model
        string prefabName = buildingData.PrefabName;

        if (!string.IsNullOrEmpty(prefabName))
        {
            NDictionary data = new NDictionary();
            prefabName = prefabName.Substring(0, prefabName.IndexOf("."));
            GameObject prefab = Resources.Load <GameObject>("Prefabs/Building/" + prefabName);
            if (prefab != null)
            {
                data.Add("model", prefab);
                modelGo = FacadeSingleton.Instance.InvokeService("OpenSubRenderer", ConstVal.Service_Sanctuary, data) as GameObject;
            }
        }
        //get attribute data
        int count = sanctuarytPackage.GetBuildingAttribute(selecttionBuilding, level);

        tableView.DataCount = count;
        tableView.TableChange();
    }
Exemple #7
0
    public WORLD_EVENTS GetEventConfigDataByConfigID(int configID)
    {
        var configList = ConfigDataStatic.GetConfigDataTable("WORLD_EVENTS");

        if (!configList.ContainsKey(configID))
        {
            Debug.Log(string.Format("World Event configID={0} missing", configID));
            return(null);
        }
        return(configList[configID] as WORLD_EVENTS);
    }
Exemple #8
0
    public ITEM_RES GetItemDataByConfigID(int configID)
    {
        var itemConfigTable = ConfigDataStatic.GetConfigDataTable("ITEM_RES");

        if (!itemConfigTable.ContainsKey(configID))
        {
            Debug.Log(string.Format("item configID={0} cant find config", configID));
            return(null);
        }
        return(itemConfigTable[configID] as ITEM_RES);
    }
Exemple #9
0
    public void CalculateTradeInfo()
    {
        mTradeInfoList.Clear();
        var dataList = ConfigDataStatic.GetConfigDataTable("ITEM_RES");

        foreach (var pair in dataList)
        {
            ITEM_RES config = pair.Value as ITEM_RES;
            mTradeInfoList.Add(new NTradeInfo(config.Id));
        }
    }
Exemple #10
0
    public void CalculateItemEffect(int configID)
    {
        var      dataMap    = ConfigDataStatic.GetConfigDataTable("ITEM_RES");
        ITEM_RES configData = dataMap[configID] as ITEM_RES;

        if (configData == null || configData.IfAvailable != 1)
        {
            return;
        }
        mItemEffectList.Clear();
        if (configData.HasHpRec)
        {
            mItemEffectList.Add(new ItemEffect("回复血量", configData.HpRec.ToString()));
        }
        if (configData.HasStarvRec)
        {
            mItemEffectList.Add(new ItemEffect("回复饥饿", configData.StarvRec.ToString()));
        }
        if (configData.HasWaterRec)
        {
            mItemEffectList.Add(new ItemEffect("回复口渴", configData.WaterRec.ToString()));
        }
        if (configData.HasHealthRec)
        {
            mItemEffectList.Add(new ItemEffect("回复健康", configData.HealthRec.ToString()));
        }
        if (configData.HasMoodRec)
        {
            mItemEffectList.Add(new ItemEffect("回复心情", configData.MoodRec.ToString()));
        }
        if (configData.HasAtkAdd)
        {
            mItemEffectList.Add(new ItemEffect("攻击", configData.AtkAdd.ToString()));
        }
        if (configData.HasDefAdd)
        {
            mItemEffectList.Add(new ItemEffect("防御", configData.DefAdd.ToString()));
        }
        if (configData.HasSpdAdd)
        {
            mItemEffectList.Add(new ItemEffect("移速", configData.SpdAdd.ToString()));
        }

        if (configData.HasLoadAdd)
        {
            mItemEffectList.Add(new ItemEffect("负载", configData.LoadAdd.ToString()));
        }
        if (configData.HasAgiAdd)
        {
            mItemEffectList.Add(new ItemEffect("敏捷", configData.AgiAdd.ToString()));
        }
    }
Exemple #11
0
    public int GetStoreHouseCap()
    {
        if (!mBuildingType2IDMap.ContainsKey(BuildingType.StoreHouse))
        {
            Debug.Log("storehouse not exist, there must be something wrong with server");
            return(0);
        }
        NBuildingInfo info       = mBuildingType2IDMap[BuildingType.StoreHouse];
        var           dataMap    = ConfigDataStatic.GetConfigDataTable("CANGKU");
        CANGKU        configData = dataMap[GetBulidingLevelByConfigID(info.configID)] as CANGKU;

        return(configData.CangkuCap);
    }
Exemple #12
0
    public static int CalculateManorLevel(int contribution)
    {
        var levelMap = ConfigDataStatic.GetConfigDataTable("MANOR_LEVEL");

        for (int i = 1; i <= 20; i++)
        {
            MANOR_LEVEL data = levelMap[i] as MANOR_LEVEL;
            if (contribution < data.ManorCap)
            {
                return(i);
            }
        }
        return(20);
    }
    void RefreshProduceBar(NDictionary data = null)
    {
        //get produce interval
        int level = userPackage.GetManorLevel();

        if (level <= 1)
        {
            proInterval = 0;
            return;
        }
        BAR_TIME config = ConfigDataStatic.GetConfigDataTable("BAR_TIME")[level] as BAR_TIME;

        proInterval = (float)config.BarTime / 1000f;
    }
Exemple #14
0
    public static int CalculatePlayerLevel(int contribution)
    {
        var levelMap = ConfigDataStatic.GetConfigDataTable("PLAYER_LEVEL");

        for (int i = 1; i <= 20; i++)
        {
            PLAYER_LEVEL data = levelMap[i] as PLAYER_LEVEL;
            if (contribution < data.PlayerCap)
            {
                return(i);
            }
        }
        return(20);
    }
Exemple #15
0
    public int GetManorLevelByStrength(NDictionary args)
    {
        int strength = args.Value <int>("strength");
        var map      = ConfigDataStatic.GetConfigDataTable("MANOR_LEVEL");

        for (int i = 1; i <= 20; i++)
        {
            MANOR_LEVEL data = map[i] as MANOR_LEVEL;
            if (strength < data.ManorCap)
            {
                return(i);
            }
        }
        return(20);
    }
Exemple #16
0
    public int GetManorLevel()
    {
        var levelMap = ConfigDataStatic.GetConfigDataTable("MANOR_LEVEL");
        int i        = 1;

        for (i = 1; i <= 20; i++)
        {
            MANOR_LEVEL data = levelMap[i] as MANOR_LEVEL;
            if (totalContribution < data.ManorCap)
            {
                return(i);
            }
        }
        return(20);
    }
Exemple #17
0
    public int GetPlayerLevel()
    {
        var levelMap = ConfigDataStatic.GetConfigDataTable("PLAYER_LEVEL");
        int i        = 0;

        for (i = 1; i <= 20; i++)
        {
            PLAYER_LEVEL data = levelMap[i] as PLAYER_LEVEL;
            if (personContribution < data.PlayerCap)
            {
                return(i);
            }
        }
        return(20);
    }
Exemple #18
0
    void GetBuildingAttributeNew(Building building, int level)
    {
        if (level >= 20)
        {
            return;
        }
        NBuildingInfo info           = GetBuildingInfo(building.BuildingID);
        BuildingFunc  func           = GetBuildingFuncByConfigID(info.configID);
        BUILDING      buildingConfig = GetBuildingConfigDataByConfigID(info.configID);
        string        funcName       = buildingConfig.BldgFuncTableName;
        object        funcConfig     = ConfigDataStatic.GetConfigDataTable(funcName)[level];

        //reflection get properties
        if (func == BuildingFunc.Collect)
        {
        }
    }
Exemple #19
0
    void ShowInvadeWarning(NMessageInfo info)
    {
        replayBtn.gameObject.SetActive(false);
        zombieNum.gameObject.SetActive(true);
        zombiePower.gameObject.SetActive(true);
        nameLabel.text = "僵尸入侵";
        var date = GlobalFunction.DateFormat(info.time);

        timeLabel.text = string.Format("{0:D2}月{1:D2}日 {2:D2}:{3:D2}",
                                       date.Month, date.Day, date.Hour, date.Minute);
        date = GlobalFunction.DateFormat(info.zombieInfo.ZombieInvadeTime);
        contentLabel.text = string.Format("僵尸正在朝你的庄园行进,请做好准备\n预计将在{0:D2}月{1:D2}日{2:D2}:{3:D2}抵达",
                                          date.Month, date.Day, date.Hour, date.Minute);
        ZOMBIE_ATTR config = ConfigDataStatic.GetConfigDataTable("ZOMBIE_ATTR")[info.zombieInfo.ConfigId] as ZOMBIE_ATTR;

        zombieNum.text   = string.Format("僵尸数量:{0}", config.ZombieNum);
        zombiePower.text = string.Format("战斗力:{0}", 6324);
    }
Exemple #20
0
    public int GetTotalProEfficiency()
    {
        UserPackage userPackage = FacadeSingleton.Instance.RetrieveData(ConstVal.Package_User) as UserPackage;
        double      sum         = 0;

        foreach (var pair in mBuildingInfoMap)
        {
            if (GetBuildingFuncByConfigID(pair.Value.configID) != BuildingFunc.Collect)
            {
                continue;
            }
            BUILDING buildingConfig = GetBuildingConfigDataByConfigID(pair.Value.configID);
            string   name           = buildingConfig.BldgFuncTableName;
            name = name.ToUpper();
            int level = GetBulidingLevelByConfigID(pair.Value.configID);

            var configMap  = ConfigDataStatic.GetConfigDataTable(name);
            var funcConfig = configMap[level];

            Type         type         = Type.GetType("com.nkm.framework.resource.data." + name);
            string       propertyName = name[0] + name.Substring(1).ToLower();
            PropertyInfo spdInfo      = type.GetProperty(propertyName + "Spd");
            int          spd          = (int)spdInfo.GetValue(funcConfig, null);
            sum += spd;
        }
        //add number buff
        int personNum = userPackage.GetManorPersonNumber();

        if (personNum == 2)
        {
            sum *= 1.6f;
        }
        if (personNum == 3)
        {
            sum *= 2.2f;
        }
        if (personNum == 4)
        {
            sum *= 2.8f;
        }
        return((int)((double)sum * userPackage.GetPlayerInterest()));
    }
    public override void DrawCell(int i, int index, int count = 0)
    {
        base.DrawCell(i, index, count);
        int dataCount = mIndex;
        List <NItemInfo> itemInfoList = itemPackage.GetItemFilterInfoList();

        info = itemInfoList[dataCount];
        var itemDataMap = ConfigDataStatic.GetConfigDataTable("ITEM_RES");

        if (!itemDataMap.ContainsKey(info.configID))
        {
            Debug.Log(string.Format("item configID={0} cant find config", info.configID));
            return;
        }
        ITEM_RES itemConfigData = itemDataMap[info.configID] as ITEM_RES;

        nameLabel.text = itemConfigData.MinName;

        numLabel.text         = GlobalFunction.NumberFormat(info.number);
        iconSprite.spriteName = itemConfigData.IconName;
    }
Exemple #22
0
    void RefreshItemInfo()
    {
        int selectionConfigID = itemPackage.GetSelectionItemConfigID();

        if (selectionConfigID == 0)
        {
            taxLabel.text    = "";
            nameLabel.text   = "";
            cdTimeLabel.text = "";
            return;
        }
        var dataList = ConfigDataStatic.GetConfigDataTable("ITEM_RES");

        if (!dataList.ContainsKey(selectionConfigID))
        {
            Debug.Log(string.Format("ITEM_RES config={0} missing", selectionConfigID));
            return;
        }

        ITEM_RES itemConfig = dataList[selectionConfigID] as ITEM_RES;

        taxLabel.text   = string.Format("当前中间人费用{0}%", itemPackage.GetTaxRate() * 100);
        nameLabel.text  = string.Format("{0}近3日价格", itemConfig.MinName);
        priceLabel.text = string.Format("当前价格: {0}", itemPackage.GetItemPrice(selectionConfigID).ToString("0.00"));
        //set buy & sell button
        NItemInfo info = itemPackage.GetItemInfo(itemPackage.GetSelectionItemConfigID());

        //PURCHASE_LIM limConfig = ConfigDataStatic.GetConfigDataTable("PURCHASE_LIM")[userPackage.GetPlayerLevel()] as PURCHASE_LIM;
        if (info == null || info.number <= 0)
        {
            sellBtn.isEnabled = false;
        }
        else
        {
            sellBtn.isEnabled = true;
        }
        RefreshBuyLimit();
        RefreshGraph();
    }
Exemple #23
0
    public int GetBuyLimit(int configID)
    {
        UserPackage userPackage = FacadeSingleton.Instance.RetrieveData(ConstVal.Package_User) as UserPackage;
        ITEM_RES    configData  = GetItemDataByConfigID(configID);
        var         dataMap     = ConfigDataStatic.GetConfigDataTable("PURCHASE_LIM");
        int         boughtNum;

        if (!mItemServerData.ContainsKey(configID))
        {
            boughtNum = 0;
        }
        else
        {
            boughtNum = mItemServerData[configID].boughtNum;
        }
        Type   type = Type.GetType("com.nkm.framework.resource.data.PURCHASE_LIM");
        string key  = configData.KeyName;

        if (key.Length <= 1)
        {
            key = key.ToUpper();
        }
        else
        {
            key = char.ToUpper(key[0]) + key.Substring(1);
        }
        PropertyInfo valInfo = type.GetProperty(key);
        int          res     = (int)valInfo.GetValue(dataMap[userPackage.GetPlayerLevel()], null) - boughtNum;

        if (res > 0)
        {
            return(res);
        }
        else
        {
            return(0);
        }
    }
Exemple #24
0
    public void GetProAttribute(int configID, out float speed, out float cap)
    {
        BUILDING buildingConfig = GetBuildingConfigDataByConfigID(configID);
        string   funcName       = buildingConfig.BldgFuncTableName;
        int      level          = GetBulidingLevelByConfigID(configID);

        funcName = funcName.ToUpper();
        var configMap  = ConfigDataStatic.GetConfigDataTable(funcName);
        var funcConfig = configMap[level];

        Type type = Type.GetType("com.nkm.framework.resource.data." + funcName);

        string       propertyName = funcName[0] + funcName.Substring(1).ToLower() + "Spd";
        PropertyInfo spdInfo      = type.GetProperty(propertyName);
        int          configSpeed  = (int)spdInfo.GetValue(funcConfig, null);

        propertyName = funcName[0] + funcName.Substring(1).ToLower() + "Cap";
        spdInfo      = type.GetProperty(propertyName);
        int configCap = (int)spdInfo.GetValue(funcConfig, null);

        speed = (float)configSpeed / 3600f;
        cap   = (float)configCap;
    }
Exemple #25
0
    public bool IsVisible(NWorldEventInfo info)
    {
        SanctuaryPackage sanctuaryPackage = FacadeSingleton.Instance.RetrieveData(ConstVal.Package_Sanctuary) as SanctuaryPackage;
        int level = sanctuaryPackage.GetBuildingLevelByType(BuildingType.RadioStation);
        int diff  = 0;

        if (level > 0)
        {
            WUXIANDIAN config = ConfigDataStatic.GetConfigDataTable("WUXIANDIAN")[level] as WUXIANDIAN;
            diff = config.WuxiandianDis;
        }
        long remainTime;

        if (GlobalFunction.GetRemainTime(info.happenTime, out remainTime))
        {
            if (diff * 1000 >= remainTime)
            {
                return(true);
            }
            return(false);
        }
        return(false);
    }
Exemple #26
0
    public BUILDING GetBuildingConfigDataByConfigID(int configID)
    {
        var buildingDataMap = ConfigDataStatic.GetConfigDataTable("BUILDING");

        return(buildingDataMap[configID] as BUILDING);
    }
Exemple #27
0
    public void RefreshHud()
    {
        if (buildingGo == null || hudBinder == null)
        {
            return;
        }
        if (hudBinder == null)
        {
            return;
        }
        hudBinder.ClearHud();
        NBuildingInfo info = sanctuaryPackage.GetBuildingInfo(buildingID);

        // check if can unlock or upgrade
        CheckIfCanUnlockOrUpgrade();
        // int configID = 0;
        // if(info != null)
        // {
        //     configID = info.configID;
        //     if(sanctuaryPackage.GetBulidingLevelByConfigID(configID) < 20)
        //         if(sanctuaryPackage.IsAbleToUnlockOrUpgrade(configID + 1))
        //             hudBinder.AddHud(HudType.Exmind);
        // }
        // else
        // {
        //     configID = sanctuaryPackage.GetConfigIDByBuildingType(buildingType);
        //     if(sanctuaryPackage.IsAbleToUnlockOrUpgrade(configID))
        //     hudBinder.AddHud(HudType.Exmind);
        // }


        if (info == null)
        {
            return;
        }
        BUILDING     config = sanctuaryPackage.GetBuildingConfigDataByConfigID(info.configID);
        BuildingFunc func   = sanctuaryPackage.GetBuildingFuncByConfigID(info.configID);

        if (mState == BuildingState.Collect)
        {
            // NDictionary args = new NDictionary();
            // args.Add("id", config.ProId);
            // hudBinder.AddHud(HudType.Collect, args);
        }
        else if (mState == BuildingState.Upgrade)
        {
            NDictionary args = new NDictionary();
            //NBuildingInfo info = sanctuaryPackage.GetBuildingInfo(buildingID);
            args.Add("finishtime", info.upgradeFinishTime);
            hudBinder.AddHud(HudType.CountDown, args);
        }
        if (func == BuildingFunc.Collect)
        {
            NDictionary args      = new NDictionary();
            var         configMap = ConfigDataStatic.GetConfigDataTable("BAR_TIME");
            BAR_TIME    barConfig = configMap[sanctuaryPackage.GetBulidingLevelByConfigID(info.configID)] as BAR_TIME;
            args.Add("interval", (float)barConfig.BarTime / 1000f);
            // float speed = (float)sanctuaryPackage.GetProSpeed(info.configID) / 3600;
            // args.Add("speed", speed);
            // args.Add("num", info.number);
            args.Add("building", this);
            hudBinder.AddHud(HudType.ProduceBar, args);
        }
        //collect hud
        if (mState == BuildingState.Idle)
        {
            if (info.number > 0)
            {
                SetCollect(true);
                mState = BuildingState.Collect;
            }

            if (func == BuildingFunc.Collect)
            {
                if (collectCo != null)
                {
                    StopCoroutine(collectCo);
                }
                collectCo = StartCoroutine(CollectTimer());
            }
        }
    }
Exemple #28
0
    /// <summary>
    /// Uggly implement of getting buliding's attribute
    /// return count of list
    /// </summary>
    public int GetBuildingAttribute(Building building, int level)
    {
        BuildingType  type = building.buildingType;
        NBuildingInfo info = GetBuildingInfo(building.BuildingID);
        BuildingFunc  func = GetBuildingFuncByConfigID(info.configID);
        List <BuildingAttributeData> dataList = new List <BuildingAttributeData>();

        switch (type)
        {
        case (BuildingType.Rice):
        {
            var  dataMap = ConfigDataStatic.GetConfigDataTable("DAMI");
            DAMI data    = dataMap[level] as DAMI;
            dataList.Add(new BuildingAttributeData("生长速度", data.DamiSpd));
            dataList.Add(new BuildingAttributeData("单次最高产量", data.DamiCap));
            break;
        }

        case (BuildingType.Veg):
        {
            var    dataMap = ConfigDataStatic.GetConfigDataTable("SHUCAI");
            SHUCAI data    = dataMap[level] as SHUCAI;
            dataList.Add(new BuildingAttributeData("生长速度", data.ShucaiSpd));
            dataList.Add(new BuildingAttributeData("单次最高产量", data.ShucaiCap));
            break;
        }

        case (BuildingType.Fertilizer):
        {
            var    dataMap = ConfigDataStatic.GetConfigDataTable("HUAFEI");
            HUAFEI data    = dataMap[level] as HUAFEI;
            dataList.Add(new BuildingAttributeData("生长速度", data.HuafeiSpd));
            dataList.Add(new BuildingAttributeData("单次最高产量", data.HuafeiCap));
            break;
        }

        case (BuildingType.Fruit):
        {
            var     dataMap = ConfigDataStatic.GetConfigDataTable("SHUIGUO");
            SHUIGUO data    = dataMap[level] as SHUIGUO;
            dataList.Add(new BuildingAttributeData("生长速度", data.ShuiguoSpd));
            dataList.Add(new BuildingAttributeData("单次最高产量", data.ShuiguoCap));
            break;
        }

        case (BuildingType.FeedFactory):
        {
            var    dataMap = ConfigDataStatic.GetConfigDataTable("SILIAO");
            SILIAO data    = dataMap[level] as SILIAO;
            dataList.Add(new BuildingAttributeData("加工速度", data.SiliaoSpd));
            dataList.Add(new BuildingAttributeData("最大加工量", data.SiliaoCap));
            break;
        }

        case (BuildingType.Well):
        {
            var  dataMap = ConfigDataStatic.GetConfigDataTable("JING");
            JING data    = dataMap[level] as JING;
            dataList.Add(new BuildingAttributeData("渗水速度", data.JingSpd));
            dataList.Add(new BuildingAttributeData("容量", data.JingCap));
            break;
        }

        case (BuildingType.WaterCollector):
        {
            var    dataMap = ConfigDataStatic.GetConfigDataTable("LUSHUI");
            LUSHUI data    = dataMap[level] as LUSHUI;
            dataList.Add(new BuildingAttributeData("收集速度", data.LushuiSpd));
            dataList.Add(new BuildingAttributeData("单次最大收集量", data.LushuiCap));
            break;
        }

        case (BuildingType.WaterFactory):
        {
            var           dataMap = ConfigDataStatic.GetConfigDataTable("KUANGQUANSHUI");
            KUANGQUANSHUI data    = dataMap[level] as KUANGQUANSHUI;
            dataList.Add(new BuildingAttributeData("加工速度", data.KuangquanshuiSpd));
            dataList.Add(new BuildingAttributeData("最大加工量", data.KuangquanshuiCap));
            break;
        }

        case (BuildingType.RadioStation):
        {
            var        dataMap = ConfigDataStatic.GetConfigDataTable("WUXIANDIAN");
            WUXIANDIAN data    = dataMap[level] as WUXIANDIAN;
            dataList.Add(new BuildingAttributeData("接受时间(秒)", data.WuxiandianDis));
            break;
        }

        case (BuildingType.Radar):
        {
            var   dataMap = ConfigDataStatic.GetConfigDataTable("LEIDA");
            LEIDA data    = dataMap[level] as LEIDA;
            dataList.Add(new BuildingAttributeData("接受时间(秒)", data.LeidaDis));
            break;
        }

        case (BuildingType.StoreHouse):
        {
            var    dataMap = ConfigDataStatic.GetConfigDataTable("CANGKU");
            CANGKU data    = dataMap[level] as CANGKU;
            dataList.Add(new BuildingAttributeData("仓库容量", data.CangkuCap));
            break;
        }

        case (BuildingType.Battery):
        {
            var       dataMap = ConfigDataStatic.GetConfigDataTable("DIANCHIZU");
            DIANCHIZU data    = dataMap[level] as DIANCHIZU;
            dataList.Add(new BuildingAttributeData("电量储存量", data.DianchizuCap));
            break;
        }

        case (BuildingType.PowerGym):
        {
            var          dataMap = ConfigDataStatic.GetConfigDataTable("JIANSHENFANG");
            JIANSHENFANG data    = dataMap[level] as JIANSHENFANG;
            dataList.Add(new BuildingAttributeData("能量转化率", data.JianshenfangSpd));
            dataList.Add(new BuildingAttributeData("每日转化上限", data.JianshenfangCap));
            break;
        }

        case (BuildingType.ZombiePlant):
        {
            var          dataMap = ConfigDataStatic.GetConfigDataTable("JSFADIANZHAN");
            JSFADIANZHAN data    = dataMap[level] as JSFADIANZHAN;
            dataList.Add(new BuildingAttributeData("能量转化率", data.JsfadianzhanSpd));
            dataList.Add(new BuildingAttributeData("单次最大储电量", data.JsfadianzhanCap));
            break;
        }

        case (BuildingType.PowerPlant):
        {
            var         dataMap = ConfigDataStatic.GetConfigDataTable("TAIYANGNENG");
            TAIYANGNENG data    = dataMap[level] as TAIYANGNENG;
            dataList.Add(new BuildingAttributeData("发电速率", data.TaiyangnengSpd));
            dataList.Add(new BuildingAttributeData("单次最大储电量", data.TaiyangnengCap));
            break;
        }

        case (BuildingType.OilFactory):
        {
            var     dataMap = ConfigDataStatic.GetConfigDataTable("LIANYOU");
            LIANYOU data    = dataMap[level] as LIANYOU;
            dataList.Add(new BuildingAttributeData("炼油速度", data.LianyouSpd));
            dataList.Add(new BuildingAttributeData("最高炼油量", data.LianyouCap));
            break;
        }

        case (BuildingType.SteelFactory):
        {
            var      dataMap = ConfigDataStatic.GetConfigDataTable("LIANGANG");
            LIANGANG data    = dataMap[level] as LIANGANG;
            dataList.Add(new BuildingAttributeData("炼钢速度", data.LiangangSpd));
            dataList.Add(new BuildingAttributeData("最高炼钢量", data.LiangangCap));
            break;
        }

        case (BuildingType.ConcreteFactory):
        {
            var       dataMap = ConfigDataStatic.GetConfigDataTable("HUNNINGTU");
            HUNNINGTU data    = dataMap[level] as HUNNINGTU;
            dataList.Add(new BuildingAttributeData("搅拌速度", data.HunningtuSpd));
            dataList.Add(new BuildingAttributeData("最高搅拌量", data.HunningtuCap));
            break;
        }

        case (BuildingType.PineWood):
        {
            var     dataMap = ConfigDataStatic.GetConfigDataTable("SONGSHU");
            SONGSHU data    = dataMap[level] as SONGSHU;
            dataList.Add(new BuildingAttributeData("生长速度", data.SongshuSpd));
            dataList.Add(new BuildingAttributeData("单次最高产量", data.SongshuCap));
            break;
        }

        case (BuildingType.WoodFactory):
        {
            var          dataMap = ConfigDataStatic.GetConfigDataTable("MUCAIJIAGONG");
            MUCAIJIAGONG data    = dataMap[level] as MUCAIJIAGONG;
            dataList.Add(new BuildingAttributeData("加工速度", data.MucaijiagongSpd));
            dataList.Add(new BuildingAttributeData("最大加工量", data.MucaijiagongCap));
            break;
        }

        case (BuildingType.Gate):
        {
            var   dataMap = ConfigDataStatic.GetConfigDataTable("DAMEN");
            DAMEN data    = dataMap[level] as DAMEN;
            dataList.Add(new BuildingAttributeData("耐久度", data.DamenDura));
            break;
        }
        }
        if (func == BuildingFunc.Collect)
        {
            BuildingAttributeData data = dataList[0];
            //add buff

            //calculate distribution
        }
        attributeDataList = dataList;
        return(attributeDataList.Count);
    }
Exemple #29
0
    void InitView()
    {
        NBuildingInfo info            = sanctuaryPackage.GetBuildingInfo(selectionBuilding.BuildingID);
        var           buildingDataMap = ConfigDataStatic.GetConfigDataTable("BUILDING");
        BUILDING      buildingData    = buildingDataMap[info.configID] as BUILDING;
        int           level           = sanctuaryPackage.GetBulidingLevelByConfigID(info.configID);
        long          remainTime      = 0;

        //check if is crafting
        isCrafting = false;
        isCollect  = false;

        if (GlobalFunction.GetRemainTime(info.processFinishTime, out remainTime))
        {
            isCrafting = true;
        }
        else if (info.number > 0)
        {
            isCollect = true;
        }

        toConfigID   = buildingData.ProId;
        fromConfigID = buildingData.ConId;
        //item name
        var      itemDataMap = ConfigDataStatic.GetConfigDataTable("ITEM_RES");
        ITEM_RES itemData    = itemDataMap[fromConfigID] as ITEM_RES;

        fromItemName.text     = itemData.MinName;
        fromSprite.spriteName = itemData.IconName;
        ratio                 = buildingData.ConPro;
        itemData              = itemDataMap[toConfigID] as ITEM_RES;
        toItemName.text       = itemData.MinName;
        describeLabel.text    = itemData.Desc;
        toSprite.spriteName   = itemData.IconName;
        descSprite.spriteName = itemData.IconName;
        // set number
        NItemInfo itemInfo = itemPackage.GetItemInfo(fromConfigID);

        craftNum     = 0;
        slider.value = 0f;
        if (itemInfo == null)
        {
            craftMax = 0;
        }
        else
        {
            int toItemMax = (int)Mathf.Floor((float)itemInfo.number / (float)ratio);
            craftMax             = toItemMax * ratio;
            slider.numberOfSteps = (int)Mathf.Ceil((float)craftMax / (float)ratio) + 1;
        }
        //check if is self
        if (info.processUID == userPackage.UserID)
        {
            isSelf = true;
        }
        else
        {
            isSelf = false;
        }

        //text
        title.text = string.Format("{0} Lv.{1}", buildingData.BldgName, level);
        collectButton.gameObject.SetActive(false);
        cancelButton.gameObject.SetActive(false);
        //stop timer
        if (TimerCo != null)
        {
            timeLabel.text = "00:00";
            StopCoroutine(TimerCo);
        }

        if (isCrafting)
        {
            //check if is self
            if (isSelf)
            {
                stateLabel.text = "你正在使用";
                cancelButton.gameObject.SetActive(true);
            }
            else
            {
                stateLabel.text = string.Format("玩家Uid{0}正在使用", info.processUID);
            }

            //set time
            if (remainTime > 0)
            {
                TimerCo = StartCoroutine(Timer(remainTime));
            }
        }
        else if (isCollect)
        {
            if (isSelf)
            {
                stateLabel.text = string.Format("可以领取{0}", info.number);
                collectButton.gameObject.SetActive(true);
            }
            timeLabel.text = "00:00";
        }
        else
        {
            stateLabel.text = "该工厂处于空闲状态";
            collectButton.gameObject.SetActive(false);
            cancelButton.gameObject.SetActive(false);
        }
        UpdateNumView();
    }