コード例 #1
0
 private bool show()
 {
     try
     {
         PowerList pl = GetPowerList();
         if (pl == null)
         {
             MessageAlert.Alert("没有任何功能权限,无法登陆!");
             return(false);
         }
         list(menu);
         foreach (string s in pl.rolepower)
         {
             foreach (MenuItem m in mll)
             {
                 if (m.Items.Count > 0)
                 {
                     m.IsEnabled = true;
                 }
                 if (s == m.Header.ToString())
                 {
                     m.IsEnabled = true;
                 }
             }
         }
         return(true);
     }
     catch
     {
         return(false);
     }
 }
コード例 #2
0
    /// <summary>
    /// Raises the collision enter event.
    /// </summary>
    /// <param name="collisionInfo">Collision info.</param>
    void OnCollisionEnter(Collision collisionInfo)
    {
        if ("PowerSpawn(Clone)" == collisionInfo.collider.name)
        {
            GameObject powerSpawn = GameObject.FindGameObjectWithTag("PowerSpawn");

            // On récupère l'id du pouvoir de l'object PowerSpawn
            int idPower = powerSpawn.GetComponent <PowerSpawn> ().getIdPower();
            //Color powerSpawnColor = powerSpawn.GetComponent<Material> ().color;

            // On récupère le tableau des pouvoirs
            GenericPower[] tmp = PowerList.GetPowerList();

            // On parcourt les pouvoirs
            foreach (GenericPower power in tmp)
            {
                // Si le pouvoir récupéré correspond au courrant du tableau
                if (idPower == power.getIdPower())
                {
                    // Alors on l'ajoute dans la liste des pouvoirs débloqué par le joueur.
                    tab_Power.Add(power);
                }
            }
        }
    }
コード例 #3
0
        protected override DataTemplate SelectTemplateCore(object item, DependencyObject container)
        {
            PowerList poweritem = (PowerList)((CategoricalDataPoint)item).DataItem;

            if (poweritem != null)
            {
                if (poweritem.Value > 20)
                {
                    return(Normal_RecTemplate);
                }
                else
                {
                    return(Warn_RecTemplate);
                }
            }
            return(null);
        }
コード例 #4
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string tempstr = (cb_role.SelectedItem as role).roleName;
                if (_powerlist.FindIndex(p => p.role == tempstr) >= 0)
                {
                    _powerlist.RemoveAt(_powerlist.FindIndex(p => p.role == tempstr));
                }
                PowerList pl = new PowerList()
                {
                    role = tempstr, rolepower = (List <string>)lv_havefunctio.ItemsSource
                };
                _powerlist.Add(pl);
                SerializeXML <PowerList> .SaveList(_powerlist);

                _powerlist = SerializeXML <PowerList> .Getlist();

                MessageAlert.Alert("保存完成!");
            }
            catch { MessageAlert.Alert("保存失败!"); }
        }
コード例 #5
0
        private void cb_role_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (this.cb_role.SelectedIndex < 0 || cb_role.SelectedItem == null)
            {
                return;
            }
            string temp = (this.cb_role.SelectedItem as role).roleName;

            try
            {
                _powerlist = Getxml();

                PowerList pl = _powerlist.Find(p => p.role == temp);
                this.lv_havefunctio.ItemsSource = null;
                tempstring.Clear();
                if (pl != null)
                {
                    this.lv_havefunctio.ItemsSource = pl.rolepower;
                    tempstring = pl.rolepower;
                }
            }
            catch { }
        }
コード例 #6
0
        string[] GetDamageData(int powerLocation)
        {
            IPower enhancedPower = MainModule.MidsController.Toon.GetEnhancedPower(powerLocation);
            float  damageValue   = enhancedPower.FXGetDamageValue();
            float  rechargeTime  = enhancedPower.RechargeTime;
            float  num1          = (float)(Math.Ceiling((double)enhancedPower.CastTimeReal / 0.131999999284744) + 1.0) * 0.132f;
            float  endCost       = enhancedPower.EndCost;

            Enums.ShortFX effectMag1 = enhancedPower.GetEffectMag(Enums.eEffectType.DamageBuff, Enums.eToWho.Self, false);
            Enums.ShortFX effectMag2 = enhancedPower.GetEffectMag(Enums.eEffectType.Resistance, Enums.eToWho.Target, false);
            effectMag1.Multiply();
            effectMag2.Multiply();
            float num2 = damageValue / num1;

            string[] strArray;
            if (damageValue != 0.0)
            {
                strArray = new string[8]
                {
                    num2.ToString(),
                        damageValue.ToString(),
                        rechargeTime.ToString(),
                        num1.ToString(),
                        endCost.ToString(),
                        effectMag1.Sum.ToString(),
                        effectMag2.Sum.ToString(),
                        powerLocation.ToString()
                }
            }
            ;
            else
            {
                strArray = new string[8]
                {
                    "-",
                    "-",
                    rechargeTime.ToString(),
                    num1.ToString(),
                    endCost.ToString(),
                    effectMag1.Sum.ToString(),
                    effectMag2.Sum.ToString(),
                    powerLocation.ToString()
                }
            };
            return(strArray);
        }

        void lvPower_ColumnClick(object sender, ColumnClickEventArgs e)
        {
            this.lvPower.Sort();
        }

        frmDPSCalc.PowerList[] IncrementRecharge(
            frmDPSCalc.PowerList[] List,
            float Time)
        {
            for (int index1 = 0; index1 < List.Length; ++index1)
            {
                int index2 = index1;
                List[index2].RechargeTimer -= Time;
            }
            return(List);
        }

        void CalculateDPS()
        {
            if (this.ibAutoMode.TextOff == "Automagical")
            {
                frmDPSCalc.PowerList[] array = new frmDPSCalc.PowerList[this.lvPower.Items.Count - 1];
                int length = 0;
                for (int index = 1; index < this.lvPower.Items.Count; ++index)
                {
                    if (this.lvPower.Items[0].Checked || this.lvPower.Items[index].Checked)
                    {
                        array[length].PowerName = this.lvPower.Items[index].Text;
                        if (this.lvPower.Items[index].SubItems[1].Text != "-")
                        {
                            array[length].Damage = float.Parse(this.lvPower.Items[index].SubItems[2].Text);
                            if (!this.chkDamageBuffs.Checked)
                            {
                                IPower basePower = MainModule.MidsController.Toon.GetBasePower(int.Parse(this.lvPower.Items[index].SubItems[8].Text), -1);
                                array[length].Damage += basePower.FXGetDamageValue() * (this.GlobalDamageBuff / 100f);
                            }
                            array[length].DPA      = float.Parse(this.lvPower.Items[index].SubItems[1].Text);
                            array[length].HidenDPA = float.Parse(this.lvPower.Items[index].SubItems[1].Text);
                        }
                        array[length].Recharge         = float.Parse(this.lvPower.Items[index].SubItems[3].Text);
                        array[length].Animation        = float.Parse(this.lvPower.Items[index].SubItems[4].Text);
                        array[length].Endurance        = float.Parse(this.lvPower.Items[index].SubItems[5].Text);
                        array[length].DamageBuff       = float.Parse(this.lvPower.Items[index].SubItems[6].Text);
                        array[length].ResistanceDeBuff = float.Parse(this.lvPower.Items[index].SubItems[7].Text);
                        array[length].RechargeTimer    = -1f;
                        if ((double)array[length].DamageBuff > 0.0 && (double)array[length].DPA != 0.0)
                        {
                            IPower basePower = MainModule.MidsController.Toon.GetBasePower(int.Parse(this.lvPower.Items[index].SubItems[8].Text), -1);
                            array[length].HidenDPA = basePower.FXGetDamageValue();
                            array[length].HidenDPA = array[length].HidenDPA * (array[length].DamageBuff / array[length].Recharge) / array[length].Animation;
                        }
                        ++length;
                    }
                }
                if (length < this.lvPower.Items.Count - 1)
                {
                    frmDPSCalc.PowerList[] powerListArray = array;
                    array = new frmDPSCalc.PowerList[length];
                    for (int index = 0; index < length; ++index)
                    {
                        array[index] = powerListArray[index];
                    }
                }
                if (array.Length > 1)
                {
                    Array.Sort(array, (x, y) => x.HidenDPA.CompareTo(y.HidenDPA));
                    float num1 = array[length - 1].Recharge + 5f;
                    int   num2 = length - 1;
                    while ((double)num1 > 0.0 && num2 > 0)
                    {
                        num1 -= array[num2--].Animation;
                    }
                    frmDPSCalc.PowerList[] List = new frmDPSCalc.PowerList[length - num2];
                    int num3 = 0;
                    for (int index = 0; index < length - num2; ++index)
                    {
                        if ((double)array[length - 1 - index].Recharge <= 20.0)
                        {
                            List[num3++] = array[length - 1 - index];
                        }
                    }
                    float num4 = 0.0f;
                    for (int index = 0; index < List.Length; ++index)
                    {
                        if ((double)num4 < (double)List[index].Recharge)
                        {
                            num4 = List[index].Recharge;
                        }
                    }
                    frmDPSCalc.PowerList[] AttackChain = new frmDPSCalc.PowerList[20];
                    int index1 = 1;
                    int index2 = 1;
                    AttackChain[0] = List[0];
                    float animation = AttackChain[0].Animation;
                    List[0].RechargeTimer = List[0].Recharge;
                    while ((double)animation < (double)num4 + 1.0)
                    {
                        for (int index3 = index1; index3 >= 0; --index3)
                        {
                            if (index1 >= List.Length)
                            {
                                animation += 0.01f;
                                List       = this.IncrementRecharge(List, 0.01f);
                            }
                            else if ((double)List[index3].RechargeTimer <= 0.0)
                            {
                                index1 = index3;
                            }
                        }
                        if (index1 >= List.Length)
                        {
                            --index1;
                            animation += 0.01f;
                            List       = this.IncrementRecharge(List, 0.01f);
                        }
                        while ((double)List[index1].RechargeTimer > 0.0)
                        {
                            ++index1;
                            if (index1 >= List.Length)
                            {
                                index1     = 0;
                                animation += 0.01f;
                                List       = this.IncrementRecharge(List, 0.01f);
                            }
                        }
                        AttackChain[index2] = List[index1];
                        animation          += AttackChain[index2].Animation;
                        List = this.IncrementRecharge(List, AttackChain[index2].Animation);
                        List[index1].RechargeTimer = List[index1].Recharge;
                        ++index1;
                        ++index2;
                    }
                    this.FillAttackChainWindow(AttackChain);
                }
                else if (array.Length == 1)
                {
                    this.tbDPSOutput.Text = "You cannot make an attack chain from one attack";
                }
                else
                {
                    this.tbDPSOutput.Text = "Come on Kiddo, gotta pick something :)";
                }
            }
            else
            {
                float num1 = 0.0f;
                float num2 = 0.0f;
                float num3 = 0.0f;
                bool  flag = true;
                for (int index = 0; index < this.GlobalPowerList.Length; ++index)
                {
                    if ((double)this.GlobalPowerList[index].Damage > 0.0)
                    {
                        num1 += this.GlobalPowerList[index].Damage;
                        num2 += this.GlobalPowerList[index].Endurance;
                        num3 += this.GlobalPowerList[index].Animation;
                        this.GlobalPowerList[index].RechargeTimer = this.GlobalPowerList[index].Recharge;
                    }
                    float animation = this.GlobalPowerList[index].Animation;
                }
                var powerListArray = new PowerList[this.GlobalPowerList.Length * 2];
                int num4           = 0;
                for (int index = 0; index < powerListArray.Length; ++index)
                {
                    if (index > this.GlobalPowerList.Length - 1)
                    {
                        num4 = index - (this.GlobalPowerList.Length - 1) - 1;
                    }
                    powerListArray[index] = this.GlobalPowerList[num4++];
                }
                for (int index1 = 0; index1 < powerListArray.Length; ++index1)
                {
                    for (int index2 = index1 + 1; index2 < powerListArray.Length; ++index2)
                    {
                        if (powerListArray[index1].PowerName != powerListArray[index2].PowerName)
                        {
                            powerListArray[index1].RechargeTimer -= powerListArray[index2].Animation;
                        }
                        else if ((double)powerListArray[index1].RechargeTimer > 0.0)
                        {
                            flag = false;
                        }
                    }
                }
                for (int index1 = powerListArray.Length - 1; index1 >= 0; --index1)
                {
                    for (int index2 = index1 - 1; index2 >= 0; --index2)
                    {
                        if (powerListArray[index1].PowerName != powerListArray[index2].PowerName)
                        {
                            powerListArray[index1].RechargeTimer -= powerListArray[index2].Animation;
                        }
                        else if ((double)powerListArray[index1].RechargeTimer > 0.0)
                        {
                            flag = false;
                        }
                    }
                }
                if (!flag)
                {
                    this.lblHeader.ForeColor = System.Drawing.Color.Red;
                    this.lblHeader.Text      = "Impossible Chain";
                }
                else
                {
                    this.lblHeader.ForeColor = System.Drawing.Color.FromArgb(192, 192, (int)byte.MaxValue);
                    this.lblHeader.Text      = "You may select -All Powers- or just the powers you want to consider.";
                }
                this.lblDPSNum.Text = (num1 / num3).ToString();
                this.lblEPSNum.Text = (num2 / num3).ToString();
            }
        }
コード例 #7
0
        private void CalculateDPS()
        {
            if (ibAutoMode.TextOff == "Automagical")
            {
                var array  = new PowerList[lvPower.Items.Count - 1];
                var length = 0;
                for (var index = 1; index < lvPower.Items.Count; ++index)
                {
                    if (!lvPower.Items[0].Checked && !lvPower.Items[index].Checked)
                    {
                        continue;
                    }
                    array[length].PowerName = lvPower.Items[index].Text;
                    if (lvPower.Items[index].SubItems[1].Text != "-")
                    {
                        array[length].Damage = float.Parse(lvPower.Items[index].SubItems[2].Text);
                        if (!chkDamageBuffs.Checked)
                        {
                            var basePower =
                                MainModule.MidsController.Toon.GetBasePower(
                                    int.Parse(lvPower.Items[index].SubItems[8].Text));
                            array[length].Damage += basePower.FXGetDamageValue() * (GlobalDamageBuff / 100f);
                        }

                        array[length].DPA      = float.Parse(lvPower.Items[index].SubItems[1].Text);
                        array[length].HidenDPA = float.Parse(lvPower.Items[index].SubItems[1].Text);
                    }

                    array[length].Recharge         = float.Parse(lvPower.Items[index].SubItems[3].Text);
                    array[length].Animation        = float.Parse(lvPower.Items[index].SubItems[4].Text);
                    array[length].Endurance        = float.Parse(lvPower.Items[index].SubItems[5].Text);
                    array[length].DamageBuff       = float.Parse(lvPower.Items[index].SubItems[6].Text);
                    array[length].ResistanceDeBuff = float.Parse(lvPower.Items[index].SubItems[7].Text);
                    array[length].RechargeTimer    = -1f;
                    if (array[length].DamageBuff > 0.0 && Math.Abs(array[length].DPA) > float.Epsilon)
                    {
                        var basePower =
                            MainModule.MidsController.Toon.GetBasePower(
                                int.Parse(lvPower.Items[index].SubItems[8].Text));
                        array[length].HidenDPA = basePower.FXGetDamageValue();
                        array[length].HidenDPA =
                            array[length].HidenDPA * (array[length].DamageBuff / array[length].Recharge) /
                            array[length].Animation;
                    }

                    ++length;
                }

                if (length < lvPower.Items.Count - 1)
                {
                    var powerListArray = array;
                    array = new PowerList[length];
                    for (var index = 0; index < length; ++index)
                    {
                        array[index] = powerListArray[index];
                    }
                }

                if (array.Length > 1)
                {
                    Array.Sort(array, (x, y) => x.HidenDPA.CompareTo(y.HidenDPA));
                    var num1 = array[length - 1].Recharge + 5f;
                    var num2 = length - 1;
                    while (num1 > 0.0 && num2 > 0)
                    {
                        num1 -= array[num2--].Animation;
                    }
                    var List = new PowerList[length - num2];
                    var num3 = 0;
                    for (var index = 0; index < length - num2; ++index)
                    {
                        if (array[length - 1 - index].Recharge <= 20.0)
                        {
                            List[num3++] = array[length - 1 - index];
                        }
                    }

                    var num4 = 0.0f;
                    for (var index = 0; index < List.Length; ++index)
                    {
                        if (num4 < (double)List[index].Recharge)
                        {
                            num4 = List[index].Recharge;
                        }
                    }

                    var AttackChain = new PowerList[20];
                    var index1      = 1;
                    var index2      = 1;
                    AttackChain[0] = List[0];
                    var animation = AttackChain[0].Animation;
                    List[0].RechargeTimer = List[0].Recharge;
                    while (animation < num4 + 1.0)
                    {
                        for (var index3 = index1; index3 >= 0; --index3)
                        {
                            if (index1 >= List.Length)
                            {
                                animation += 0.01f;
                                List       = IncrementRecharge(List, 0.01f);
                            }
                            else if (List[index3].RechargeTimer <= 0.0)
                            {
                                index1 = index3;
                            }
                        }

                        if (index1 >= List.Length)
                        {
                            --index1;
                            animation += 0.01f;
                            List       = IncrementRecharge(List, 0.01f);
                        }

                        while (List[index1].RechargeTimer > 0.0)
                        {
                            ++index1;
                            if (index1 < List.Length)
                            {
                                continue;
                            }
                            index1     = 0;
                            animation += 0.01f;
                            List       = IncrementRecharge(List, 0.01f);
                        }

                        AttackChain[index2] = List[index1];
                        animation          += AttackChain[index2].Animation;
                        List = IncrementRecharge(List, AttackChain[index2].Animation);
                        List[index1].RechargeTimer = List[index1].Recharge;
                        ++index1;
                        ++index2;
                    }

                    FillAttackChainWindow(AttackChain);
                }
                else if (array.Length == 1)
                {
                    tbDPSOutput.Text = "You cannot make an attack chain from one attack";
                }
                else
                {
                    tbDPSOutput.Text = "Come on Kiddo, gotta pick something :)";
                }
            }
            else
            {
                var num1 = 0.0f;
                var num2 = 0.0f;
                var num3 = 0.0f;
                var flag = true;
                for (var index = 0; index < GlobalPowerList.Length; ++index)
                {
                    if (GlobalPowerList[index].Damage > 0.0)
                    {
                        num1 += GlobalPowerList[index].Damage;
                        num2 += GlobalPowerList[index].Endurance;
                        num3 += GlobalPowerList[index].Animation;
                        GlobalPowerList[index].RechargeTimer = GlobalPowerList[index].Recharge;
                    }

                    var animation = GlobalPowerList[index].Animation;
                }

                var powerListArray = new PowerList[GlobalPowerList.Length * 2];
                var num4           = 0;
                for (var index = 0; index < powerListArray.Length; ++index)
                {
                    if (index > GlobalPowerList.Length - 1)
                    {
                        num4 = index - (GlobalPowerList.Length - 1) - 1;
                    }
                    powerListArray[index] = GlobalPowerList[num4++];
                }

                for (var index1 = 0; index1 < powerListArray.Length; ++index1)
                {
                    for (var index2 = index1 + 1; index2 < powerListArray.Length; ++index2)
                    {
                        if (powerListArray[index1].PowerName != powerListArray[index2].PowerName)
                        {
                            powerListArray[index1].RechargeTimer -= powerListArray[index2].Animation;
                        }
                        else if (powerListArray[index1].RechargeTimer > 0.0)
                        {
                            flag = false;
                        }
                    }
                }

                for (var index1 = powerListArray.Length - 1; index1 >= 0; --index1)
                {
                    for (var index2 = index1 - 1; index2 >= 0; --index2)
                    {
                        if (powerListArray[index1].PowerName != powerListArray[index2].PowerName)
                        {
                            powerListArray[index1].RechargeTimer -= powerListArray[index2].Animation;
                        }
                        else if (powerListArray[index1].RechargeTimer > 0.0)
                        {
                            flag = false;
                        }
                    }
                }

                if (!flag)
                {
                    lblHeader.ForeColor = Color.Red;
                    lblHeader.Text      = "Impossible Chain";
                }
                else
                {
                    lblHeader.ForeColor = Color.FromArgb(192, 192, byte.MaxValue);
                    lblHeader.Text      = "You may select -All Powers- or just the powers you want to consider.";
                }

                lblDPSNum.Text = (num1 / num3).ToString(CultureInfo.InvariantCulture);
                lblEPSNum.Text = (num2 / num3).ToString(CultureInfo.InvariantCulture);
            }
        }