Ejemplo n.º 1
0
    protected override Nullable <ItemIdentity> GetFinishedHeadProduct(BuildingIdentity id)
    {
        BuildingLogicData factory = LogicController.Instance.GetBuildingObject(id);

        if (factory.ItemProducts == null)
        {
            return(null);
        }
        ItemLogicObject item = LogicController.Instance.GetItemObject(factory.ItemProducts[0].Value[0]);

        if (!item.LogicProduceRemainingWorkload.IsZero())
        {
            return(null);
        }
        return(item.Identity);
    }
Ejemplo n.º 2
0
    protected virtual void ShowProgress()
    {
        if (!this.BuildingBehavior.Created)
        {
            return;
        }
        if (SceneManager.Instance.SceneMode == SceneMode.SceneVisit)
        {
            if (this.BuildingLogicData.CurrentBuilidngState != BuildingEditorState.Normal)
            {
                this.ActiveFacility(true);
            }
            else
            {
                this.ActiveFacility(false);
            }
            return;
        }
        if (this.BuildingLogicData.CurrentBuilidngState == BuildingEditorState.Update)
        {
            this.ActiveFacility(true);
            foreach (KeyValuePair <int, ProgressBarBehavior> pb in m_ProgressBarBehaviorDictionary)
            {
                if (pb.Key == 4)
                {
                    pb.Value.gameObject.SetActive(true);
                    pb.Value.SetProgressPosition(0);
                    pb.Value.SetProgressBar((this.BuildingLogicData.UpgradeWorkload - this.BuildingLogicData.UpgradeRemainingWorkload) / this.BuildingLogicData.UpgradeWorkload, this.BuildingLogicData.UpgradeRemainingWorkload / this.BuildingLogicData.AttachedBuilderEfficiency, false, string.Empty);
                }
                else
                {
                    pb.Value.gameObject.SetActive(false);
                }
            }
        }
        else
        {
            this.ActiveFacility(false);
            m_ProgressBarBehaviorDictionary[4].gameObject.SetActive(false);
            if (this.BuildingLogicData.CurrentBuilidngState == BuildingEditorState.Normal)
            {
                int order = 0;
                foreach (KeyValuePair <int, ProgressBarBehavior> pb in m_ProgressBarBehaviorDictionary)
                {
                    switch (pb.Key)
                    {
                    case 0:    //0 = UpgradeSpell
                        if (this.BuildingLogicData.ItemUpgrade.HasValue)
                        {
                            pb.Value.gameObject.SetActive(true);
                            pb.Value.SetProgressPosition(order);
                            float remainingTime = this.BuildingLogicData.ItemUpgradeRemainingTime;
                            float progress      = (this.BuildingLogicData.ItemUpgradeTotalWorkload - this.BuildingLogicData.ItemUpgradeRemainingWorkload) / (float)this.BuildingLogicData.ItemUpgradeTotalWorkload;
                            pb.Value.SetProgressBar(progress, remainingTime, true, ClientSystemConstants.Spell_ICON_COMMON_DICTIONARY[this.BuildingLogicData.ItemUpgrade.Value]);
                            order++;
                        }
                        else
                        {
                            pb.Value.gameObject.SetActive(false);
                        }
                        break;

                    case 1:    //ProduceSpell
                        if (this.BuildingLogicData.ItemProducts != null)
                        {
                            if (this.BuildingLogicData.ItemProducts.Count > 0)
                            {
                                pb.Value.gameObject.SetActive(true);
                                pb.Value.SetProgressPosition(order);
                                ItemIdentity    itemIdentity    = this.BuildingLogicData.ItemProducts[0].Value[0];
                                ItemLogicObject itemLogicObject = LogicController.Instance.GetItemObject(itemIdentity);
                                float           remainingTime   = (float)itemLogicObject.ProduceRemainingWorkload / ConfigInterface.Instance.SystemConfig.ProduceItemEfficiency;
                                float           progress        = (itemLogicObject.ProduceTotalWorkload - itemLogicObject.ProduceRemainingWorkload) / (float)itemLogicObject.ProduceTotalWorkload;
                                pb.Value.SetProgressBar(progress, remainingTime, true, ClientSystemConstants.Spell_ICON_COMMON_DICTIONARY[itemIdentity.itemType]);
                                order++;
                            }
                            else
                            {
                                pb.Value.gameObject.SetActive(false);
                            }
                        }

                        break;

                    case 2:    //2 = UpgradeArmy
                        if (this.BuildingLogicData.ArmyUpgrade.HasValue)
                        {
                            if (this.BuildingLogicData.IsArmyProduceBlock && !this.BuildingBehavior.IsClick)
                            {
                                order++;
                            }
                            pb.Value.gameObject.SetActive(true);
                            pb.Value.SetProgressPosition(order);
                            float remainingTime = this.BuildingLogicData.ArmyUpgradeRemainingTime;    // (float)this.BuildingLogicData.ArmyUpgradeRemainWorkload / this.BuildingLogicData.ArmyUpgradeEfficiency;
                            float progress      = (this.BuildingLogicData.ArmyUpgradeTotalWorkload - this.BuildingLogicData.ArmyUpgradeRemainWorkload) / (float)this.BuildingLogicData.ArmyUpgradeTotalWorkload;
                            pb.Value.SetProgressBar(progress, remainingTime, true, ClientSystemConstants.ARMY_UPGRADE_ICON_COMMON_DICTIONARY[this.BuildingLogicData.ArmyUpgrade.Value]);
                            order++;
                        }
                        else
                        {
                            pb.Value.gameObject.SetActive(false);
                        }
                        break;

                    case 3:    //ProduceArmy
                        if (this.BuildingLogicData.ArmyProducts != null && !this.BuildingLogicData.IsArmyProduceBlock)
                        {
                            if (this.BuildingLogicData.ArmyProducts.Count > 0)
                            {
                                pb.Value.gameObject.SetActive(true);
                                pb.Value.SetProgressPosition(order);
                                ArmyIdentity  armyIdentity  = this.BuildingLogicData.ArmyProducts[0].Value[0];
                                ArmyLogicData armyLogicData = LogicController.Instance.GetArmyObjectData(armyIdentity);
                                float         remainingTime = (float)armyLogicData.ProduceRemainingWorkload / ConfigInterface.Instance.SystemConfig.ProduceArmyEfficiency;

                                float progress = (armyLogicData.ProduceTotalWorkload - armyLogicData.ProduceRemainingWorkload) / (float)armyLogicData.ProduceTotalWorkload;
                                pb.Value.SetProgressBar(progress, remainingTime, true, ClientSystemConstants.ARMY_ICON_COMMON_DICTIONARY[armyIdentity.armyType]);
                                order++;
                            }
                            else
                            {
                                pb.Value.gameObject.SetActive(false);
                            }
                        }
                        else
                        {
                            pb.Value.gameObject.SetActive(false);
                        }

                        break;
                    }
                }
            }
        }
    }