Ejemplo n.º 1
0
        public void FindAllControlStrings_SplitsFoundControlStringByControlStringSeparator()
        {
            const char ControlStringStarter    = '{';
            const char ControlStringTerminator = '}';
            const char ControlStringSeparator  = ':';

            var input = $"{ControlStringStarter}foo{ControlStringSeparator}bar{ControlStringTerminator}";

            var unit = new ControlStringFinder(ControlStringStarter, ControlStringSeparator, ControlStringTerminator, 'b', 'c', 'd');

            var valueQueue = new Queue <string>();

            valueQueue.Enqueue("foo");
            valueQueue.Enqueue("bar");

            var expected = new ControlString(0, 9, valueQueue, new Queue <string>());

            // Act
            var result = unit.FindAllControlStrings(input).Single();

            result.Length.ShouldBe(expected.Length);

            result.Values.Dequeue();
            expected.Values.Dequeue();

            result.Values.Peek().ShouldBe(expected.Values.Peek());
        }
Ejemplo n.º 2
0
 public void SetName(Data data)
 {
     ObjectName.text = data.type;
     ImageName1.text = ControlString.CutTextBefore(data.imageURL1, '.');
     if (data.imageURL2 != null)
     {
         ImageName2.text = ControlString.CutTextBefore(data.imageURL2, '.');
     }
 }
Ejemplo n.º 3
0
            public string Match(ControlString controlString)
            {
                if (!Matches(controlString))
                {
                    throw new ArgumentException("Argument cannot be matched by this matcher.", nameof(controlString));
                }

                return(matcher.Match(controlString));
            }
Ejemplo n.º 4
0
 public void MoveImage(string path)
 {
     Debug.LogError(Path.Combine(path, ControlString.CutTextAfter(ImageURL1, '\\')));
     if (ImageURL1 != "" && ImageURL1 != null && !File.Exists(Path.Combine(path, ControlString.CutTextAfter(ImageURL1, '\\'))))
     {
         File.Copy(ImageURL1, Path.Combine(path, ControlString.CutTextAfter(ImageURL1, '\\')));
     }
     if (ImageURL2 != "" && ImageURL2 != null && !File.Exists(Path.Combine(path, ControlString.CutTextAfter(ImageURL2, '\\'))))
     {
         File.Copy(ImageURL2, Path.Combine(path, ControlString.CutTextAfter(ImageURL2, '\\')));
     }
 }
Ejemplo n.º 5
0
    public void make_list()
    {
#if UNITY_EDITOR
        string[] names = get_folder_name(@"C:\Users\holme\Desktop\もいっこ用\TableGameData");
#else
        Debug.LogError("adafsfwef");
        string[] names = get_folder_name(Path.Combine(AppDomain.CurrentDomain.BaseDirectory.TrimEnd('\\'), "TableGameData"));
#endif
        //Debug.LogError(Path.Combine(AppDomain.CurrentDomain.BaseDirectory.TrimEnd('\\'), "TableGameData"));
        foreach (string name in names)
        {
            GameObject Obj = (GameObject)Instantiate(DataNode, this.transform.position, Quaternion.identity);
            Obj.transform.parent = Content.transform;
            Obj.transform.Find("FolderName").GetComponent <Text>().text = ControlString.CutTextAfter(name, '\\');
            Obj.GetComponent <Content>().LoadManager = this.gameObject;
        }
    }
Ejemplo n.º 6
0
    public void DoneButton()
    {
        GameObject obj = Instantiate(ContentPanel_prefab) as GameObject;

        obj.transform.parent = ScrollViewContent.transform;
        Data data = obj.AddComponent <Data>();

        data.type      = Type_dropdown.captionText.text;
        data.num       = (int)counter.getValue();
        data.imageURL1 = ControlString.CutTextAfter(ImageURL1, '\\');
        obj.GetComponent <ImageName>().ImageURL1 = ImageURL1;
        if (data.type == "piece")
        {
            data.imageURL2 = ControlString.CutTextAfter(ImageURL2, '\\');
            obj.GetComponent <ImageName>().ImageURL2 = ImageURL2;
        }
        if (data.type == "board")
        {
            data.size = (int)boardSizeCounter.getValue();
        }
        obj.GetComponent <GameobjectPanel>().SetManager(this);
        obj.GetComponent <GameobjectPanel>().SetName(data);
    }
Ejemplo n.º 7
0
    public IEnumerator GetTexture(String url)
    {
        if (ControlString.CutTextAfter(url, '\\') != null)
        {
            Debug.Log(url);
            UnityWebRequest www = UnityWebRequestTexture.GetTexture(url);


            yield return(www.SendWebRequest());

            if (www.isNetworkError || www.isHttpError)
            {
                Debug.Log("ここは->" + AppDomain.CurrentDomain.BaseDirectory.TrimEnd('\\'));
                Debug.LogError("UnityWebRequesT ERROR =>" + url);
                Debug.Log(www.error);
            }
            else
            {
                Texture myTexture = ((DownloadHandlerTexture)www.downloadHandler).texture;
                this.gameObject.GetComponent <Renderer>().material.SetTexture("_MainTex", myTexture);
                Debug.Log("Collect Attach image");
            }
        }
    }
Ejemplo n.º 8
0
        private void CycleGeneratorComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            string armor = "Molten Armor";
            CalculationOptionsMage calculationOptions = character.CalculationOptions as CalculationOptionsMage;
            CalculationsMage       calculations       = (CalculationsMage)Calculations.Instance;
            Solver solver = new Solver(character, calculationOptions, false, false, false, 0, armor, false, false, false, false);

            solver.Initialize(null);

            switch ((string)((ComboBoxItem)CycleGeneratorComboBox.SelectedItem).Content)
            {
            case "Arcane (MB/2T10 duration collapsed)":
                castingState = new CastingState(solver, 0, false, 0);
                generator    = new ArcaneCycleGenerator(castingState, true, false, true, false, true, true);
                break;

            case "Arcane (Arcane Power, MB/2T10 duration collapsed)":
                castingState = new CastingState(solver, (int)StandardEffect.ArcanePower, false, 0);
                generator    = new ArcaneCycleGenerator(castingState, true, false, true, false, true, true);
                break;

            case "Arcane (ABar on cooldown only, MB/2T10 duration/ABar cooldown collapsed)":
                castingState = new CastingState(solver, 0, false, 0);
                generator    = new ArcaneCycleGenerator(castingState, true, true, true, true, true, true);
                break;

            case "Arcane (no ABar, MB duration collapsed)":
                castingState = new CastingState(solver, 0, false, 0);
                generator    = new ArcaneCycleGenerator(castingState, false, true, true, true, false, true);
                break;

            case "Arcane Movement (average 1 per 10 sec for 1 sec)":
                castingState = new CastingState(solver, 0, false, 0);
                generator    = new ArcaneMovementCycleGenerator(castingState, 0.1f, 1.0f, true, false, true, true, true, true);
                break;

            case "Frost":
                castingState = new CastingState(solver, 0, false, 0);
                generator    = new FrostCycleGenerator(castingState, true, false);
                break;

            case "Frost (no latency combos)":
                castingState = new CastingState(solver, 0, false, 0);
                generator    = new FrostCycleGenerator(castingState, false, false);
                break;

            case "Frost+Deep Freeze":
                castingState = new CastingState(solver, 0, false, 0);
                generator    = new FrostCycleGenerator2(castingState, true, true, 30.0f, false, false, false);
                break;

            case "Frost+Deep Freeze (no latency combos)":
                castingState = new CastingState(solver, 0, false, 0);
                generator    = new FrostCycleGenerator2(castingState, false, true, 30.0f, false, false, false);
                break;

            case "Frost+Deep Freeze (2T10 duration collapsed)":
                castingState = new CastingState(solver, 0, false, 0);
                generator    = new FrostCycleGenerator2(castingState, true, true, 30.0f, true, false, false);
                break;

            case "Frost+Deep Freeze (2T10 duration collapsed, no latency combos)":
                castingState = new CastingState(solver, 0, false, 0);
                generator    = new FrostCycleGenerator2(castingState, false, true, 30.0f, true, false, false);
                break;

            case "Frost+Deep Freeze (FOF instants on last charge only, 2T10 duration collapsed)":
                castingState = new CastingState(solver, 0, false, 0);
                generator    = new FrostCycleGenerator2(castingState, true, true, 30.0f, true, true, false);
                break;

            case "Frost+Deep Freeze (FOF instants on last charge only, 2T10 duration collapsed, no latency combos)":
                castingState = new CastingState(solver, 0, false, 0);
                generator    = new FrostCycleGenerator2(castingState, false, true, 30.0f, true, true, false);
                break;

            case "Frost+Deep Freeze (FOF instants on last charge only, 2T10 duration collapsed, 10 sec Deep Freeze cooldown)":
                castingState = new CastingState(solver, 0, false, 0);
                generator    = new FrostCycleGenerator2(castingState, true, true, 10.0f, true, true, false);
                break;

            case "Frost+Deep Freeze (FOF instants on last charge only, 2T10 duration collapsed, 10 sec Deep Freeze cooldown, no latency combos)":
                castingState = new CastingState(solver, 0, false, 0);
                generator    = new FrostCycleGenerator2(castingState, false, true, 10.0f, true, true, false);
                break;

            case "FrostFFB+Deep Freeze":
                castingState = new CastingState(solver, 0, false, 0);
                generator    = new FrostCycleGenerator2(castingState, true, true, 30.0f, false, false, true);
                break;

            case "FrostFFB+Deep Freeze (no latency combos)":
                castingState = new CastingState(solver, 0, false, 0);
                generator    = new FrostCycleGenerator2(castingState, false, true, 30.0f, false, false, true);
                break;

            case "FrostFFB+Deep Freeze (2T10 duration collapsed)":
                castingState = new CastingState(solver, 0, false, 0);
                generator    = new FrostCycleGenerator2(castingState, true, true, 30.0f, true, false, true);
                break;

            case "FrostFFB+Deep Freeze (2T10 duration collapsed, no latency combos)":
                castingState = new CastingState(solver, 0, false, 0);
                generator    = new FrostCycleGenerator2(castingState, false, true, 30.0f, true, false, true);
                break;

            case "FrostFFB+Deep Freeze (FOF instants on last charge only, 2T10 duration collapsed)":
                castingState = new CastingState(solver, 0, false, 0);
                generator    = new FrostCycleGenerator2(castingState, true, true, 30.0f, true, true, true);
                break;

            case "FrostFFB+Deep Freeze (FOF instants on last charge only, 2T10 duration collapsed, no latency combos)":
                castingState = new CastingState(solver, 0, false, 0);
                generator    = new FrostCycleGenerator2(castingState, false, true, 30.0f, true, true, true);
                break;

            case "FrostFFB+Deep Freeze (FOF instants on last charge only, 2T10 duration collapsed, 10 sec Deep Freeze cooldown)":
                castingState = new CastingState(solver, 0, false, 0);
                generator    = new FrostCycleGenerator2(castingState, true, true, 10.0f, true, true, true);
                break;

            case "FrostFFB+Deep Freeze (FOF instants on last charge only, 2T10 duration collapsed, 10 sec Deep Freeze cooldown, no latency combos)":
                castingState = new CastingState(solver, 0, false, 0);
                generator    = new FrostCycleGenerator2(castingState, false, true, 10.0f, true, true, true);
                break;

            case "Fire":
                castingState = new CastingState(solver, 0, false, 0);
                generator    = new FireCycleGenerator(castingState);
                break;
            }

            if (castingState == null || generator == null)
            {
                return;
            }

            if (character.Ranged != null)
            {
                wand = new WandTemplate(solver, (MagicSchool)character.Ranged.Item.DamageType, character.Ranged.Item.MinDamage, character.Ranged.Item.MaxDamage, character.Ranged.Item.Speed).GetSpell(castingState);
            }

            StringBuilder sb = new StringBuilder();

            sb.AppendLine(generator.StateDescription);

            sb.AppendLine("");
            for (int i = 0; i < generator.ControlOptions.Length; i++)
            {
                sb.Append(i);
                sb.Append(": ");
                sb.Append(generator.StateList[Array.IndexOf(generator.ControlIndex, i)]);
                sb.Append(": ");
                foreach (var kvp in generator.SpellMap[i])
                {
                    sb.Append(kvp.Value);
                    sb.Append("=");
                    sb.Append(kvp.Key);
                    sb.Append("  ");
                }
                sb.AppendLine();
            }

            Description.Text   = sb.ToString();
            ControlString.Text = new string('0', generator.ControlOptions.Length);

            //ControlString.SelectAll();
            ControlString.Focus();

            Calculate_Click(null, null);
        }
Ejemplo n.º 9
0
        private void CycleGeneratorComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            string armor;
            Solver solver;
            CalculationOptionsMage calculationOptions = character.CalculationOptions as CalculationOptionsMage;
            CalculationsMage       calculations       = (CalculationsMage)Calculations.Instance;

            switch ((string)((ComboBoxItem)CycleGeneratorComboBox.SelectedItem).Content)
            {
            case "Arcane":
            default:
                armor  = "Mage Armor";
                solver = new Solver(character, calculationOptions, false, false, false, 0, armor, false, false, false, false, true, false, false);
                solver.Initialize(null);
                castingState = new CastingState(solver, 0, false, 0);
                generator    = new ArcaneCycleGeneratorBeta(castingState, true, false, false, false);
                break;

            case "Arcane Dragonwrath":
                armor  = "Mage Armor";
                solver = new Solver(character, calculationOptions, false, false, false, 0, armor, false, false, false, false, true, false, false);
                solver.Initialize(null);
                castingState = new CastingState(solver, 0, false, 0);
                generator    = new ArcaneCycleGeneratorLegendary(castingState, true, false, false, false);
                break;

            case "Arcane Hyper Regen":
                armor  = "Mage Armor";
                solver = new Solver(character, calculationOptions, false, false, false, 0, armor, false, false, false, false, true, false, false);
                solver.Initialize(null);
                castingState = new CastingState(solver, 0, false, 0);
                generator    = new ArcaneCycleGeneratorBeta(castingState, true, false, false, true);
                break;

            case "Arcane AOE":
                armor  = "Mage Armor";
                solver = new Solver(character, calculationOptions, false, false, false, 0, armor, false, false, false, false, true, false, false);
                solver.Initialize(null);
                castingState = new CastingState(solver, 0, false, 0);
                generator    = new ArcaneAOECycleGenerator(castingState, true, false, false);
                break;

            case "Frost":
                armor  = "Molten Armor";
                solver = new Solver(character, calculationOptions, false, false, false, 0, armor, false, false, false, false, true, false, false);
                solver.Initialize(null);
                castingState = new CastingState(solver, 0, false, 0);
                generator    = new FrostCycleGeneratorBeta(castingState, false, 0.0f, false, 0.0f);
                break;

            case "Frost+Deep Freeze":
                armor  = "Molten Armor";
                solver = new Solver(character, calculationOptions, false, false, false, 0, armor, false, false, false, false, true, false, false);
                solver.Initialize(null);
                castingState = new CastingState(solver, 0, false, 0);
                generator    = new FrostCycleGeneratorBeta(castingState, true, 30.0f, false, 0.0f);
                break;

            case "Frost+Freeze":
                armor  = "Molten Armor";
                solver = new Solver(character, calculationOptions, false, false, false, 0, armor, false, false, false, false, true, false, false);
                solver.Initialize(null);
                castingState = new CastingState(solver, 0, false, 0);
                generator    = new FrostCycleGeneratorBeta(castingState, false, 0.0f, true, 25.0f);
                break;

            case "Frost+Freeze+Deep Freeze":
                armor  = "Molten Armor";
                solver = new Solver(character, calculationOptions, false, false, false, 0, armor, false, false, false, false, true, false, false);
                solver.Initialize(null);
                castingState = new CastingState(solver, 0, false, 0);
                generator    = new FrostCycleGeneratorBeta(castingState, true, 30.0f, true, 25.0f);
                break;
            }

            if (castingState == null || generator == null)
            {
                return;
            }

            if (character.Ranged != null)
            {
                wand = new WandTemplate(solver, (MagicSchool)character.Ranged.Item.DamageType, character.Ranged.Item.MinDamage, character.Ranged.Item.MaxDamage, character.Ranged.Item.Speed).GetSpell(castingState);
            }

            StringBuilder sb = new StringBuilder();

            sb.AppendLine(generator.StateDescription);

            sb.AppendLine();
            for (int i = 0; i < generator.ControlOptions.Length; i++)
            {
                sb.Append(i);
                sb.Append(": ");
                sb.Append(generator.StateList[Array.IndexOf(generator.ControlIndex, i)]);
                sb.Append(": ");
                List <int> keys = new List <int>();
                foreach (var kvp in generator.SpellMap[i])
                {
                    keys.Add(generator.SpellList.IndexOf(kvp.Key));
                }
                keys.Sort();
                foreach (var key in keys)
                {
                    sb.Append(key);
                    sb.Append("=");
                    sb.Append(generator.SpellList[key]);
                    sb.Append("  ");
                }
                sb.AppendLine();
            }

            sb.AppendLine();
            sb.AppendLine("Transitions:");
            sb.AppendLine();

            for (int i = 0; i < generator.ControlOptions.Length; i++)
            {
                foreach (var kvp in generator.SpellMap[i])
                {
                    sb.Append(i);
                    sb.Append(": ");
                    sb.Append(kvp.Key);
                    sb.Append(" => ");

                    List <int> list = new List <int>();
                    for (int s = 0; s < generator.ControlIndex.Length; s++)
                    {
                        if (generator.ControlIndex[s] == i)
                        {
                            foreach (CycleControlledStateTransition transition in generator.StateList[s].Transitions)
                            {
                                string n;
                                if (transition.Spell != null)
                                {
                                    n = transition.Spell.Name;
                                }
                                else
                                {
                                    n = "Pause";
                                }
                                if (n == kvp.Key)
                                {
                                    int target = generator.ControlIndex[transition.TargetState.Index];
                                    if (!list.Contains(target))
                                    {
                                        list.Add(target);
                                    }
                                }
                            }
                        }
                    }

                    list.Sort();
                    sb.Append(string.Join(",", list));

                    sb.AppendLine();
                }
            }


            Description.Text   = sb.ToString();
            ControlString.Text = generator.ConvertCycleNameInternalToEasy(new string('0', generator.ControlOptions.Length));

            //ControlString.SelectAll();
            ControlString.Focus();

            Calculate_Click(null, null);
        }
Ejemplo n.º 10
0
        public void NextControlString_DequeuesFirstItemFromValueQueue([Frozen] Queue <string> values, ControlString unit, string firstString, string secondString)
        {
            values.Enqueue(firstString);
            values.Enqueue(secondString);

            unit.NextControlString.Values.Peek().ShouldBe(unit.Values.Skip(1).First());
        }
Ejemplo n.º 11
0
        public void NextControlString_DecreasesLengthByCurrentValueLength([Frozen] Queue <string> values, ControlString unit, string firstString, string secondString)
        {
            values.Enqueue(firstString);
            values.Enqueue(secondString);

            unit.NextControlString.Length.ShouldBe(unit.Length - unit.Values.Peek().Length);
        }
Ejemplo n.º 12
0
 public bool Matches(ControlString controlString) => matcher.Matches(controlString);
Ejemplo n.º 13
0
 public string Match(ControlString controlString) => matcher.Match(controlString);