Example #1
0
 public void Initialize()
 {
     model = new PowerModel();
     model.Power
     .Subscribe(i => view.OnPowerChanged(i));
     model.SetPower(1);
 }
Example #2
0
        public string GetInnerPower()
        {
            string json    = Server.UrlDecode(Utilities.CacheHelper.GetCache("power" + StorageHelper.Cookie.GetCookieValue("User", "uguid")).ToString());
            string collStr = Utilities.CacheHelper.GetCache(StorageHelper.Cookie.GetCookieValue("User", "uguid") + "Controll").ToString().ToLower();

            if (collStr == "/home/getfile")
            {
                collStr = "/home/pageone";
            }
            PowerModel    pmodel = JsonConvert.DeserializeObject <PowerModel>(json);
            List <PModel> plist  = pmodel.menu;
            List <CModel> oList  = new List <CModel>();

            if (plist != null)
            {
                foreach (var item in plist)
                {
                    List <CModel> clist = item.child;
                    foreach (var cmodel in clist)
                    {
                        if (cmodel.url.ToLower().IndexOf(collStr) > -1)
                        {
                            oList = clist;
                        }
                    }
                }
            }

            return(JsonConvert.SerializeObject(oList));
        }
        private void BindPowerMode()
        {
            Power = new ObservableCollection <PowerModel>();
            string _series = SelectedSeries.SelectedValues;

            _project = JCHVRF.Model.Project.GetProjectInstance;
            if (!string.IsNullOrWhiteSpace(_series))
            {
                thisProject = _project;

                DataTable dtPower = Global.InitPowerList(thisProject, _series);
                foreach (DataRow dtSeriesTypeRow in dtPower.Rows)
                {
                    var powerModel = new PowerModel()
                    {
                        DisplayName    = dtSeriesTypeRow.ItemArray[0].ToString(),
                        SelectedValues = dtSeriesTypeRow.ItemArray[0].ToString(),
                        Code           = dtSeriesTypeRow.ItemArray[1].ToString()
                    };
                    Power.Add(powerModel);

                    if (proj != null && powerModel.SelectedValues.Equals(proj.Power))
                    {
                        SelectedPower = powerModel;
                    }
                }
                if (Power != null && Power.Count > 0 && SelectedPower == null)
                {
                    SelectedPower = Power[0];
                }
            }
        }
Example #4
0
            public static void Postfix()
            {
                foreach (var power in Powers.Keys)
                {
                    if (Powers[power] < 0)
                    {
                        continue;
                    }
                    PowerModel powerModel = Game.instance.model.GetPowerWithName(power);

                    if (powerModel.tower != null)
                    {
                        if (powerModel.tower.icon == null)
                        {
                            powerModel.tower.icon = powerModel.icon;
                        }

                        powerModel.tower.cost     = Powers[power];
                        powerModel.tower.towerSet = "Support";

                        if (power == "EnergisingTotem")
                        {
                            var behavior = powerModel.tower.behaviors
                                           .First(b => b.name == "RateSupportModel_EnergisingTotem_").Cast <RateSupportModel>();
                            behavior.multiplier = 1 - AttackSpeedBoost;
                        }
                    }
                }
            }
Example #5
0
        public static TowerModel CreateTower(string power)
        {
            PowerModel powerModel = Game.instance.model.GetPowerWithName(power);
            TowerModel towerModel =
                Game.instance.model.GetTowerWithName("NaturesWardTotem").Clone().Cast <TowerModel>();

            towerModel.name                = power;
            towerModel.icon                = powerModel.icon;
            towerModel.cost                = Main.Powers[power];
            towerModel.display             = power;
            towerModel.baseId              = power;
            towerModel.towerSet            = "Support";
            towerModel.radiusSquared       = 9;
            towerModel.radius              = 3;
            towerModel.range               = 0;
            towerModel.footprint           = new CircleFootprintModel(power, 0, true, false, true);
            towerModel.showPowerTowerBuffs = false;

            towerModel.behaviors.First(b => b.name.Contains("OnExpire"))
            .Cast <CreateEffectOnExpireModel>().effectModel = powerModel.behaviors
                                                              .First(b => b.name.Contains("Effect")).Cast <CreateEffectOnPowerModel>().effectModel;


            towerModel.behaviors.First(b => b.name.Contains("Sound")).Cast <CreateSoundOnTowerPlaceModel>()
            .sound1.assetId = powerModel.behaviors.First(b => b.name.Contains("Sound")).Cast <CreateSoundOnPowerModel>().sound.assetId;
            towerModel.behaviors.First(b => b.name.Contains("Sound")).Cast <CreateSoundOnTowerPlaceModel>()
            .sound2.assetId = powerModel.behaviors.First(b => b.name.Contains("Sound")).Cast <CreateSoundOnPowerModel>().sound.assetId;

            towerModel.behaviors.First(b => b.name.Contains("Sound")).Cast <CreateSoundOnTowerPlaceModel>()
            .heroSound1 = new BlankSoundModel();
            towerModel.behaviors.First(b => b.name.Contains("Sound")).Cast <CreateSoundOnTowerPlaceModel>()
            .heroSound2 = new BlankSoundModel();

            var displayModel = towerModel.behaviors.First(b => b.name.Contains("Display"))
                               .Cast <DisplayModel>();

            displayModel.display = "8ab0e3fbb093a554d84a85e18fe2acac"; //tiny little caltrops

            var powerBehaviorModel = powerModel.behaviors.First(b => !b.name.Contains("Create"));
            var projectleModel     = GetProjectileModel(powerBehaviorModel);

            if (projectleModel != null)
            {
                projectleModel.pierce = Main.TrackPowers[power];
                if (projectleModel.maxPierce != 0)
                {
                    projectleModel.maxPierce = Main.TrackPowers[power];
                }
            }

            //towerModel.behaviors = towerModel.behaviors.Where(b => !b.name.Contains("Display")).ToArray();

            //towerModel.behaviors.First(b => b.name.Contains("Display")).Cast<DisplayModel>().display = powerModel.icon.GUID;

            towerModel.behaviors = towerModel.behaviors.Where(b => !b.name.Contains("Slow")).ToArray();

            return(towerModel);
        }
Example #6
0
            public static void Postfix()
            {
                PowerModel powerModel = Game.instance.model.GetPowerWithName("TechBot");

                if (powerModel.tower.icon == null)
                {
                    powerModel.tower.icon = powerModel.icon;
                }
                powerModel.tower.cost     = techBotCost;
                powerModel.tower.towerSet = "Support";
            }
            public static void Postfix()
            {
                PowerModel powerModel = Game.instance.model.GetPowerWithName("BananaFarmer");

                if (powerModel.tower.icon == null)
                {
                    powerModel.tower.icon = powerModel.icon;
                }
                powerModel.tower.cost     = bananaFarmerCost;
                powerModel.tower.towerSet = "Support";
            }
Example #8
0
            internal static void Postfix(StandardInstaTowerButton __instance, PowerModel powerModel, bool isInsta)
            {
                var costText = __instance.GetComponentsInChildren <TextMeshProUGUI>()
                               .FirstOrDefault(text => text.name == "Cost");

                float unit = __instance.tiers.fontSize / 3;

                if (costText == null)
                {
                    costText      = Object.Instantiate(__instance.tiers, __instance.tiers.transform.parent, true);
                    costText.name = "Cost";
                    costText.transform.Translate(0, unit, 0);
                    costText.color = Color.red;
                }

                var cost = GetCostForThing(powerModel.tower);

                costText.SetText($"${cost:n0}");

                var tier         = __instance.instaTowerModel.tier;
                var discountText = __instance.GetComponentsInChildren <TextMeshProUGUI>()
                                   .FirstOrDefault(text => text.name == "Discount");

                if (discountText == null)
                {
                    discountText = Object.Instantiate(__instance.powerCountText,
                                                      __instance.powerCountText.transform.parent, true);
                    discountText.name = "Discount";
                    discountText.transform.Translate(unit * 3, 0, 0);
                    discountText.color = Color.green;
                }

                if (tier > 0)
                {
                    discountText.SetText("-" + tier * 5 + "%");
                }
                else
                {
                    discountText.SetText("");
                }
            }
Example #9
0
            public static void Postfix()
            {
                for (int i = 0; i < Constants.powers.Length; i++)
                {
                    PowerModel powerModel = Game.instance.model.GetPowerWithName(Constants.powers[i]);

                    if (powerModel.tower.icon == null)
                    {
                        powerModel.tower.icon = powerModel.icon;
                    }

                    powerModel.tower.cost     = Constants.powerCosts[i];
                    powerModel.tower.towerSet = "Support";
                }

                for (int i = 0; i < Constants.otherTowers.Length; i++)
                {
                    TowerModel otherTowerModel = Game.instance.model.GetTowerWithName(Constants.otherTowers[i]);

                    if (otherTowerModel.icon == null)
                    {
                        otherTowerModel.icon = otherTowerModel.portrait;
                    }
                    if (Constants.otherTowers[i] == "SunAvatarMini")
                    {
                        otherTowerModel.icon = Game.instance.model.GetTowerWithName("SuperMonkey-300").portrait;
                    }
                    if (Constants.otherTowers[i] == "TransformedBaseMonkey")
                    {
                        otherTowerModel.icon = Game.instance.model.GetTowerWithName("Alchemist-050").portrait;
                    }

                    otherTowerModel.cost     = Constants.towerCosts[i];
                    otherTowerModel.towerSet = Constants.otherTowerTowersets[i];
                }

                Console.WriteLine("Configured tower models");
            }
 public static bool HasBehavior <T>(this PowerModel model) where T : Model
 {
     return(model.behaviors.HasItemsOfType <PowerBehaviorModel, T>());
 }
 public static void RemoveBehaviors <T>(this PowerModel model) where T : Model
 {
     model.behaviors = model.behaviors.RemoveItemsOfType <PowerBehaviorModel, T>(model);
 }
 public static void RemoveBehavior <T>(this PowerModel model, T behavior) where T : Model
 {
     model.behaviors = model.behaviors.RemoveItem(behavior);
     model.RemoveChildDependant(behavior);
 }
 public static void AddBehavior <T>(this PowerModel model, T behavior) where T : PowerBehaviorModel
 {
     model.behaviors = model.behaviors.AddTo(behavior);
     model.AddChildDependant(behavior);
 }
 public static List <T> GetBehaviors <T>(this PowerModel model) where T : Model
 {
     return(model.behaviors.GetItemsOfType <PowerBehaviorModel, T>());
 }
Example #15
0
 public double NominalPower(PowerModel powerModel)
 {
     powerModel.Result = Power.NominalPower(powerModel.PowerFront, powerModel.PowerBack);
     return(powerModel.Result);
 }