Пример #1
0
 // Private methods
 private void Init()
 {
     blocks      = GameObject.FindGameObjectWithTag("Blocks").GetComponent <blocks>();
     target      = GameObject.FindGameObjectWithTag("Target").GetComponent <target>();
     sum         = GameObject.FindGameObjectWithTag("Sum").GetComponent <sum>();
     combo       = GameObject.FindGameObjectWithTag("Combo").GetComponent <combo>();
     timer       = GameObject.FindGameObjectWithTag("Timer").GetComponent <timer>();
     lifes_score = GameObject.FindGameObjectWithTag("LifesScore").GetComponent <lifes_score>();
     game_over   = GameObject.FindGameObjectWithTag("GameOver").GetComponent <game_over>();
     stage       = GameObject.FindGameObjectWithTag("Stage").GetComponent <stage>();
     refresh     = GameObject.FindGameObjectWithTag("Refresh").GetComponent <refresh>();
 }
Пример #2
0
 // Start is called before the first frame update
 void Start()
 {
     game_manager = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameManager>();
     block_array  = gameObject.GetComponentsInChildren <block>();
     target       = GameObject.FindGameObjectWithTag("Target").GetComponent <target>();
     sum          = GameObject.FindGameObjectWithTag("Sum").GetComponent <sum>();
     combo        = GameObject.FindGameObjectWithTag("Combo").GetComponent <combo>();
     timer        = GameObject.FindGameObjectWithTag("Timer").GetComponent <timer>();
     lifes_score  = GameObject.FindGameObjectWithTag("LifesScore").GetComponent <lifes_score>();
     stage        = GameObject.FindGameObjectWithTag("Stage").GetComponent <stage>();
     refresh      = GameObject.FindGameObjectWithTag("Refresh").GetComponent <refresh>();
     swipe        = GameObject.FindGameObjectWithTag("Swipe").GetComponent <ParticleSystem>();
     audio        = gameObject.GetComponent <AudioSource>();
     generate_random_numbers();
     set_block_clickabable_array();
     damage_off();
 }
Пример #3
0
    combo findComboByType(ResourceType tartgetType)
    {
        combo target = new combo();

        foreach (var item in combos)
        {
            if (item.workplace == null)
            {
                break;
            }
            if (item.workplace.GetComponent <ResourceExtractor>().extractedResourceType == tartgetType)
            {
                target = item;
            }
        }
        return(target);
    }
Пример #4
0
    void createCombos()
    {
        addAllTaggedToList("workplace", ref workplaces);

        foreach (var item in workplaces)
        {
            combo c = new combo();

            c.workplace = item;
            c.minions   = new List <GameObject>();
            combos.Add(c);
        }
        combo house = new combo();

        house.workplace = GameObject.FindGameObjectWithTag("house");
        house.minions   = new List <GameObject>();
        combos.Add(house);

        GameObject[] minions = GameObject.FindGameObjectsWithTag("minion");

        foreach (var minion in minions)
        {
            GameObject ab = minion.GetComponent <MinionAI>().assignedBuilding;
            if (ab == null)
            {
                combos[combos.Count - 1].minions.Add(minion);
            }
            else
            {
                foreach (var combo in combos)
                {
                    if (combo.workplace == ab)
                    {
                        combo.minions.Add(minion);
                    }
                }
            }
        }
    }
Пример #5
0
        public void readCombos(string behavName)
        {
            if (!Silverfish.Instance.BehaviorPath.ContainsKey(behavName))
            {
                help.ErrorLog(behavName + ": no special combos.");
                return;
            }

            string pathToCombo = Path.Combine(Silverfish.Instance.BehaviorPath[behavName], "_combo.txt");

            if (!System.IO.File.Exists(pathToCombo))
            {
                help.ErrorLog(behavName + ": no special combos.");
                return;
            }

            help.ErrorLog("[Combo] Load combos for " + behavName);
            string[] lines = new string[0] {
            };
            combos.Clear();
            playByValue.Clear();
            try
            {
                lines = System.IO.File.ReadAllLines(pathToCombo);
            }
            catch
            {
                help.logg("cant find _combo.txt");
                help.ErrorLog("cant find _combo.txt (if you dont created your own combos, ignore this message)");
                return;
            }
            help.logg("read _combo.txt...");
            help.ErrorLog("read _combo.txt...");
            foreach (string line in lines)
            {
                if (line == "" || line == null)
                {
                    continue;
                }
                if (line.StartsWith("//"))
                {
                    continue;
                }
                if (line.Contains("weapon:"))
                {
                    try
                    {
                        this.attackFaceHP = Convert.ToInt32(line.Replace("weapon:", ""));
                    }
                    catch
                    {
                        help.logg("combomaker cant read: " + line);
                        help.ErrorLog("combomaker cant read: " + line);
                    }
                }
                else
                {
                    if (line.Contains("cardvalue:"))
                    {
                        try
                        {
                            string            cardvalue = line.Replace("cardvalue:", "");
                            CardDB.cardIDEnum ce        = cdb.cardIdstringToEnum(cardvalue.Split(',')[0]);
                            int val = Convert.ToInt32(cardvalue.Split(',')[1]);
                            if (this.playByValue.ContainsKey(ce))
                            {
                                continue;
                            }
                            this.playByValue.Add(ce, val);
                            //help.ErrorLog("adding: " + line);
                        }
                        catch
                        {
                            help.logg("combomaker cant read: " + line);
                            help.ErrorLog("combomaker cant read: " + line);
                        }
                    }
                    else
                    {
                        try
                        {
                            combo c = new combo(line);
                            this.combos.Add(c);
                        }
                        catch
                        {
                            help.logg("combomaker cant read: " + line);
                            help.ErrorLog("combomaker cant read: " + line);
                        }
                    }
                }
            }
            help.ErrorLog("[Combo] " + combos.Count + " combos loaded successfully, " + playByValue.Count + " values loaded successfully");
        }
Пример #6
0
        private void readCombos()
        {
            string[] lines = new string[0] {
            };
            combos.Clear();

            string       path           = Settings.Instance.path;
            string       cleanpath      = "Silverfish" + Path.DirectorySeparatorChar;
            string       datapath       = path + "Data" + Path.DirectorySeparatorChar;
            string       cleandatapath  = cleanpath + "Data" + Path.DirectorySeparatorChar;
            string       classpath      = datapath + ownClass + Path.DirectorySeparatorChar;
            string       cleanclasspath = cleandatapath + ownClass + Path.DirectorySeparatorChar;
            string       deckpath       = classpath + deckName + Path.DirectorySeparatorChar;
            string       cleandeckpath  = cleanclasspath + deckName + Path.DirectorySeparatorChar;
            const string filestring     = "_combo.txt";

            if (deckName != "" && File.Exists(deckpath + filestring))
            {
                path      = deckpath;
                cleanPath = cleandeckpath + filestring;
            }
            else if (deckName != "" && File.Exists(classpath + filestring))
            {
                path      = classpath;
                cleanPath = cleanclasspath + filestring;
            }
            else if (deckName != "" && File.Exists(datapath + filestring))
            {
                path      = datapath;
                cleanPath = cleandatapath + filestring;
            }
            else if (File.Exists(path + filestring))
            {
                cleanPath = cleanpath + filestring;
            }
            else
            {
                Helpfunctions.Instance.ErrorLog("[Combo] cant find base _combo.txt, consider creating one");
                return;
            }
            Helpfunctions.Instance.ErrorLog("[Combo] read " + cleanPath);

            try
            {
                lines = File.ReadAllLines(path + filestring);
            }
            catch
            {
                Helpfunctions.Instance.ErrorLog("_combo.txt read error. Continuing without user-defined rules.");
                return;
            }

            foreach (string line in lines)
            {
                string shortline = line.Replace(" ", "");
                if (shortline.StartsWith("//"))
                {
                    continue;
                }
                if (shortline.Length == 0)
                {
                    continue;
                }

                if (line.Contains("weapon:"))
                {
                    try
                    {
                        this.attackFaceHP = Convert.ToInt32(line.Replace("weapon:", ""));
                    }
                    catch
                    {
                        Helpfunctions.Instance.ErrorLog("combomaker cant read: " + line);
                    }
                }
                else
                {
                    if (line.Contains("cardvalue:"))
                    {
                        try
                        {
                            string            cardvalue = line.Replace("cardvalue:", "");
                            CardDB.cardIDEnum ce        = CardDB.Instance.cardIdstringToEnum(cardvalue.Split(',')[0]);
                            int val = Convert.ToInt32(cardvalue.Split(',')[1]);
                            if (this.playByValue.ContainsKey(ce))
                            {
                                continue;
                            }
                            this.playByValue.Add(ce, val);
                            //Helpfunctions.Instance.ErrorLog("adding: " + line);
                        }
                        catch
                        {
                            Helpfunctions.Instance.ErrorLog("combomaker cant read: " + line);
                        }
                    }
                    else
                    {
                        try
                        {
                            combo c = new combo(line);
                            this.combos.Add(c);
                        }
                        catch
                        {
                            Helpfunctions.Instance.ErrorLog("combomaker cant read: " + line);
                        }
                    }
                }
            }
            if (combos.Count > 0)
            {
                Helpfunctions.Instance.ErrorLog("[Combo] " + combos.Count + " combo rules found");
            }
            if (playByValue.Count > 0)
            {
                Helpfunctions.Instance.ErrorLog("[Combo] " + playByValue.Count + " card value rules found");
            }
        }
Пример #7
0
        private void readCombos()
        {
            string[] lines = new string[0] { };
            combos.Clear();
            try
            {
                string path = Settings.Instance.path;
                lines = System.IO.File.ReadAllLines(path + "_combo.txt");
            }
            catch
            {
                Helpfunctions.Instance.logg("cant find _combo.txt");
                Helpfunctions.Instance.ErrorLog("cant find _combo.txt (if you dont created your own combos, ignore this message)");
                return;
            }
            Helpfunctions.Instance.logg("read _combo.txt...");
            Helpfunctions.Instance.ErrorLog("read _combo.txt...");
            foreach (string line in lines)
            {

                if (line.Contains("weapon:"))
                {
                    try
                    {
                        this.attackFaceHP = Convert.ToInt32(line.Replace("weapon:", ""));
                    }
                    catch
                    {
                        Helpfunctions.Instance.logg("combomaker cant read: " + line);
                        Helpfunctions.Instance.ErrorLog("combomaker cant read: " + line);
                    }
                }
                else
                {
                    if (line.Contains("cardvalue:"))
                    {
                        try
                        {
                            string cardvalue = line.Replace("cardvalue:", "");
                            CardDB.cardIDEnum ce = CardDB.Instance.cardIdstringToEnum(cardvalue.Split(',')[0]);
                            int val = Convert.ToInt32(cardvalue.Split(',')[1]);
                            if (this.playByValue.ContainsKey(ce)) continue;
                            this.playByValue.Add(ce, val);
                            //Helpfunctions.Instance.ErrorLog("adding: " + line);
                        }
                        catch
                        {
                            Helpfunctions.Instance.logg("combomaker cant read: " + line);
                            Helpfunctions.Instance.ErrorLog("combomaker cant read: " + line);
                        }
                    }
                    else
                    {
                        try
                        {
                            combo c = new combo(line);
                            this.combos.Add(c);
                        }
                        catch
                        {
                            Helpfunctions.Instance.logg("combomaker cant read: " + line);
                            Helpfunctions.Instance.ErrorLog("combomaker cant read: " + line);
                        }
                    }
                }

            }

        }
Пример #8
0
        public void readCombos(string behavName, bool nameIsPath = false)
        {
            var pathToCombo = behavName;

            if (!nameIsPath)
            {
                if (!Silverfish.Instance.BehaviorPath.ContainsKey(behavName))
                {
                    this.help.ErrorLog($"{behavName}: 没有特定的“连招”.");
                    return;
                }

                pathToCombo = Path.Combine(Silverfish.Instance.BehaviorPath[behavName], "_combo.txt");
            }

            if (!File.Exists(pathToCombo))
            {
                this.help.ErrorLog($"{behavName}: 没有特定的“连招”.");
                return;
            }

            this.help.ErrorLog($"[连招功能] 成功加载“连招” {behavName}");
            var lines = new string[0] {
            };

            this.combos.Clear();
            this.playByValue.Clear();
            try
            {
                lines = File.ReadAllLines(pathToCombo);
            }
            catch
            {
                this.help.logg("没有发现“连招功能”文本 _combo.txt");
                this.help.ErrorLog("“连招功能”文本 _combo.txt ");
                return;
            }

            this.help.logg("加载“连招功能”文本 _combo.txt...");
            this.help.ErrorLog("加载“连招功能”文本 _combo.txt...");
            foreach (var line in lines)
            {
                if (line == "" || line == null)
                {
                    continue;
                }

                if (line.StartsWith("//"))
                {
                    continue;
                }

                if (line.Contains("weapon:"))
                {
                    try
                    {
                        this.attackFaceHP = Convert.ToInt32(line.Replace("weapon:", ""));
                    }
                    catch
                    {
                        this.help.logg($"[连招功能]不能加载: {line}");
                        this.help.ErrorLog($"[连招功能]不能加载: {line}");
                    }
                }
                else
                {
                    if (line.Contains("cardvalue:"))
                    {
                        try
                        {
                            var     cardvalue = line.Replace("cardvalue:", "");
                            SimCard ce        = cardvalue.Split(',')[0];
                            var     val       = Convert.ToInt32(cardvalue.Split(',')[1]);
                            if (this.playByValue.ContainsKey(ce))
                            {
                                continue;
                            }

                            this.playByValue.Add(ce, val);
                            //help.ErrorLog("adding: " + line);
                        }
                        catch
                        {
                            this.help.logg($"[连招功能]不能加载: {line}");
                            this.help.ErrorLog($"[连招功能]不能加载: {line}");
                        }
                    }
                    else
                    {
                        try
                        {
                            var c = new combo(line);
                            this.combos.Add(c);
                        }
                        catch
                        {
                            this.help.logg($"[连招功能]不能加载: {line}");
                            this.help.ErrorLog($"[连招功能]不能加载: {line}");
                        }
                    }
                }
            }

            this.help.ErrorLog($"[连招功能] {this.combos.Count} “连招”功能激活成功, {this.playByValue.Count} 个权重值已加载");
        }
Пример #9
0
 private void readCombos()
 {
     string[] lines = new string[0] {
     };
     combos.Clear();
     try
     {
         string path = Settings.Instance.path;
         lines = System.IO.File.ReadAllLines(path + "_combo.txt");
     }
     catch
     {
         Helpfunctions.Instance.logg("cant find _combo.txt");
         Helpfunctions.Instance.ErrorLog("cant find _combo.txt (if you dont created your own combos, ignore this message)");
         return;
     }
     Helpfunctions.Instance.logg("read _combo.txt...");
     Helpfunctions.Instance.ErrorLog("read _combo.txt...");
     foreach (string line in lines)
     {
         if (line.Contains("weapon:"))
         {
             try
             {
                 this.attackFaceHP = Convert.ToInt32(line.Replace("weapon:", ""));
             }
             catch
             {
                 Helpfunctions.Instance.logg("combomaker cant read: " + line);
                 Helpfunctions.Instance.ErrorLog("combomaker cant read: " + line);
             }
         }
         else
         {
             if (line.Contains("cardvalue:"))
             {
                 try
                 {
                     string            cardvalue = line.Replace("cardvalue:", "");
                     CardDB.cardIDEnum ce        = CardDB.Instance.cardIdstringToEnum(cardvalue.Split(',')[0]);
                     int val = Convert.ToInt32(cardvalue.Split(',')[1]);
                     if (this.playByValue.ContainsKey(ce))
                     {
                         continue;
                     }
                     this.playByValue.Add(ce, val);
                     //Helpfunctions.Instance.ErrorLog("adding: " + line);
                 }
                 catch
                 {
                     Helpfunctions.Instance.logg("combomaker cant read: " + line);
                     Helpfunctions.Instance.ErrorLog("combomaker cant read: " + line);
                 }
             }
             else
             {
                 try
                 {
                     combo c = new combo(line);
                     this.combos.Add(c);
                 }
                 catch
                 {
                     Helpfunctions.Instance.logg("combomaker cant read: " + line);
                     Helpfunctions.Instance.ErrorLog("combomaker cant read: " + line);
                 }
             }
         }
     }
 }
Пример #10
0
 // Start is called before the first frame update
 void Start()
 {
     game_manager = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameManager>();
     combo        = GameObject.FindGameObjectWithTag("Combo").GetComponent <combo>();
 }
Пример #11
0
        public void ReadCombos(string behavName, bool nameIsPath = false)
        {
            string pathToCombo = behavName;

            if (!nameIsPath)
            {
                if (!SilverFishBot.Instance.BehaviorPath.ContainsKey(behavName))
                {
                    help.ErrorLog(behavName + ": no special combos.");
                    return;
                }
                pathToCombo = Path.Combine(SilverFishBot.Instance.BehaviorPath[behavName], "_combo.txt");
            }

            if (!File.Exists(pathToCombo))
            {
                help.InfoLog(behavName + ": no special combos.");
                return;
            }

            help.InfoLog($"[Combo] Load combos for {behavName}");
            string[] lines = new string[0] {
            };
            combos.Clear();
            playByValue.Clear();
            try
            {
                lines = File.ReadAllLines(pathToCombo);
            }
            catch (Exception ex)
            {
                LogHelper.WriteCombatLog("cant find _combo.txt");
                help.ErrorLog(ex);
                help.ErrorLog("cant find _combo.txt (if you don't created your own combos, ignore this message)");
                return;
            }
            help.InfoLog("read _combo.txt...");
            foreach (string line in lines)
            {
                if (string.IsNullOrEmpty(line))
                {
                    continue;
                }
                if (line.StartsWith("//"))
                {
                    continue;
                }
                if (line.Contains("weapon:"))
                {
                    try
                    {
                        this.attackFaceHP = Convert.ToInt32(line.Replace("weapon:", ""));
                    }
                    catch (Exception ex)
                    {
                        LogHelper.WriteCombatLog("combomaker cant read: " + line);
                        help.ErrorLog(ex);
                        help.ErrorLog("combomaker cant read: " + line);
                    }
                }
                else
                {
                    if (line.Contains("cardvalue:"))
                    {
                        try
                        {
                            string            cardvalue = line.Replace("cardvalue:", "");
                            CardDB.cardIDEnum ce        = cdb.cardIdstringToEnum(cardvalue.Split(',')[0]);
                            int val = Convert.ToInt32(cardvalue.Split(',')[1]);
                            if (this.playByValue.ContainsKey(ce))
                            {
                                continue;
                            }
                            this.playByValue.Add(ce, val);
                            //help.ErrorLog("adding: " + line);
                        }
                        catch (Exception ex)
                        {
                            LogHelper.WriteCombatLog("combomaker cant read: " + line);
                            help.ErrorLog(ex);
                            help.ErrorLog("combomaker cant read: " + line);
                        }
                    }
                    else
                    {
                        try
                        {
                            combo c = new combo(line);
                            this.combos.Add(c);
                        }
                        catch (Exception ex)
                        {
                            LogHelper.WriteCombatLog("combomaker cant read: " + line);
                            help.ErrorLog(ex);
                            help.ErrorLog("combomaker cant read: " + line);
                        }
                    }
                }
            }
            help.InfoLog("[Combo] " + combos.Count + " combos loaded successfully, " + playByValue.Count + " values loaded successfully");
        }
Пример #12
0
        public void readCombos(string behavName, bool nameIsPath = false)
        {
            string pathToCombo = behavName;

            if (!nameIsPath)
            {
                if (!Silverfish.Instance.BehaviorPath.ContainsKey(behavName))
                {
                    help.ErrorLog(behavName + ": 没有特定的“连招”.");
                    return;
                }
                pathToCombo = Path.Combine(Silverfish.Instance.BehaviorPath[behavName], "_combo.txt");
            }

            if (!System.IO.File.Exists(pathToCombo))
            {
                help.ErrorLog(behavName + ": 没有特定的“连招”.");
                return;
            }

            help.ErrorLog("[连招功能] 成功加载“连招” " + behavName);
            string[] lines = new string[0] {
            };
            combos.Clear();
            playByValue.Clear();
            try
            {
                lines = System.IO.File.ReadAllLines(pathToCombo);
            }
            catch
            {
                help.logg("没有发现“连招功能”文本 _combo.txt");
                help.ErrorLog("“连招功能”文本 _combo.txt ");
                return;
            }
            help.logg("加载“连招功能”文本 _combo.txt...");
            help.ErrorLog("加载“连招功能”文本 _combo.txt...");
            foreach (string line in lines)
            {
                if (line == "" || line == null)
                {
                    continue;
                }
                if (line.StartsWith("//"))
                {
                    continue;
                }
                if (line.Contains("weapon:"))
                {
                    try
                    {
                        this.attackFaceHP = Convert.ToInt32(line.Replace("weapon:", ""));
                    }
                    catch
                    {
                        help.logg("[连招功能]不能加载: " + line);
                        help.ErrorLog("[连招功能]不能加载: " + line);
                    }
                }
                else
                {
                    if (line.Contains("cardvalue:"))
                    {
                        try
                        {
                            string            cardvalue = line.Replace("cardvalue:", "");
                            CardDB.cardIDEnum ce        = cdb.cardIdstringToEnum(cardvalue.Split(',')[0]);
                            int val = Convert.ToInt32(cardvalue.Split(',')[1]);
                            if (this.playByValue.ContainsKey(ce))
                            {
                                continue;
                            }
                            this.playByValue.Add(ce, val);
                            //help.ErrorLog("adding: " + line);
                        }
                        catch
                        {
                            help.logg("[连招功能]不能加载: " + line);
                            help.ErrorLog("[连招功能]不能加载: " + line);
                        }
                    }
                    else
                    {
                        try
                        {
                            combo c = new combo(line);
                            this.combos.Add(c);
                        }
                        catch
                        {
                            help.logg("[连招功能]不能加载: " + line);
                            help.ErrorLog("[连招功能]不能加载: " + line);
                        }
                    }
                }
            }
            help.ErrorLog("[连招功能] " + combos.Count + " “连招”功能激活成功, " + playByValue.Count + " 个权重值已加载");
        }
Пример #13
0
 private void Start()
 {
     mat         = GetComponent <Renderer>().material;
     box_manager = GameObject.Find("box_manager");
     Combo       = box_manager.GetComponent <combo>();
 }
Пример #14
0
 private void readCombos()
 {
     string[] lines = new string[0] { };
     combos.Clear();
     try
     {
         string path = Settings.Instance.path;
         lines = System.IO.File.ReadAllLines(path + "_combo.txt");
     }
     catch
     {
         Helpfunctions.Instance.logg("cant find _combo.txt");
         return;
     }
     Helpfunctions.Instance.logg("read _combo.txt...");
     foreach (string line in lines)
     {
         if (line.Contains("weapon:"))
         {
             try
             {
                 this.attackFaceHP = Convert.ToInt32(line.Replace("weapon:", ""));
             }
             catch
             {
                 Helpfunctions.Instance.logg("combomaker cant read: " + line);
             }
         }
         else
         {
             try
             {
                 combo c = new combo(line);
                 this.combos.Add(c);
             }
             catch
             {
                 Helpfunctions.Instance.logg("combomaker cant read: " + line);
             }
         }
     }
 }
Пример #15
0
 select(combo: oc.contract, positions: oc.contract.Legs().Select(c => (c, p)).ToArray(), oc.order.OrderId)