Exemple #1
0
        public void BuildPanel(PanelBuilder panel, string title, Player player = null)
        {
            try
            {
                //addHeader
                if (reqs.Count == 0)
                {
                    return;
                }

                panel.AddHeaderLabel(title);

                //add req
                foreach (var req in reqs)
                {
                    BaseReq r = OLib.GetReq(req[0]);
                    if (player == null)
                    {
                        panel.AddLabel(r.Desc(null, req[1]));
                    }
                    else
                    {
                        panel.AddImageLabel(r.Desc(player, req[1]), r.Check(player, req[1]));
                    }
                }
            }
            catch (Exception e)
            {
                ExceptionHelper.ShowException(e);
            }
        }
Exemple #2
0
        /// <summary>
        /// Check if the req allow it
        /// </summary>
        /// <param name="player"></param>
        /// <param name="reqs"></param>
        /// <returns>true=can use it, false=not possible</returns>
        public static bool Check(Player player, Dictionary <string, string> reqs)
        {
            foreach (KeyValuePair <string, string> req in reqs)
            {
                //can use it?
                if (!OLib.GetReq(req.Key).Check(player, req.Value))
                {
                    return(false);
                }
            }

            return(true);
        }
Exemple #3
0
        /// <summary>
        /// Check if the req allow it
        /// </summary>
        /// <param name="player"></param>
        /// <param name="reqs"></param>
        /// <param name="onMap"></param>
        /// <param name="pos"></param>
        /// <returns>true=can use it, false=not possible</returns>
        public static bool Check(Player player, Dictionary <string, string> reqs, MapElementInfo onMap, NVector pos)
        {
            foreach (KeyValuePair <string, string> req in reqs)
            {
                //can use it?
                if (!OLib.GetReq(req.Key).Check(player, onMap, req.Value, pos))
                {
                    return(false);
                }
            }

            return(true);
        }
Exemple #4
0
        /// <summary>
        /// Check if the req allow it
        /// </summary>
        /// <param name="player"></param>
        /// <param name="reqs"></param>
        /// <returns>true=can use it, false=not possible</returns>
        public static bool CheckOnlyFinal(Player player, Dictionary <string, string> reqs)
        {
            foreach (KeyValuePair <string, string> req in reqs)
            {
                //can use it?
                BaseReq r = OLib.GetReq(req.Key);
                if (!r.Check(player, req.Value) && r.Final(player, req.Value))
                {
                    return(false);
                }
            }

            return(true);
        }
Exemple #5
0
        /// <summary>
        /// Check if the req allow it
        /// </summary>
        /// <param name="player"></param>
        /// <param name="final"></param>
        /// <returns>true=can use it, false=not possible</returns>
        public bool Check(Player player, bool final = false)
        {
            foreach (var req in reqs)
            {
                //can use it?
                BaseReq r = OLib.GetReq(req[0]);
                if (!r.Check(player, req[1]) && (r.Final(player, req[1]) || !final))
                {
                    return(false);
                }
            }

            return(true);
        }
Exemple #6
0
        /// <summary>
        /// Check if the req allow it
        /// </summary>
        /// <param name="player"></param>
        /// <param name="onMap"></param>
        /// <param name="pos"></param>
        /// <param name="final"></param>
        /// <returns>true=can use it, false=not possible</returns>
        public bool Check(Player player, MapElementInfo onMap, NVector pos, bool final = false)
        {
            foreach (var req in reqs)
            {
                //can use it?
                BaseReq r = OLib.GetReq(req[0]);
                if (!r.Check(player, onMap, req[1], pos) && (r.Final(player, onMap, req[1], pos) || !final))
                {
                    return(false);
                }
            }

            return(true);
        }
Exemple #7
0
        public void AddReq(string title, Dictionary <string, string> reqs, MapElementInfo onMap, NVector pos)
        {
            //addHeader
            if (reqs.Count > 0)
            {
                AddHeaderLabel(title);
            }

            //add req
            foreach (KeyValuePair <string, string> req in reqs)
            {
                BaseReq r = OLib.GetReq(req.Key);
                AddImageLabel(r.Desc(S.ActPlayer(), onMap, req.Value, pos), r.Check(S.ActPlayer(), onMap, req.Value, pos) ? "ui:yes" : "ui:no");
            }
        }
Exemple #8
0
        /// <summary>
        /// Return the description, why the check its not working
        /// </summary>
        /// <param name="player"></param>
        /// <param name="reqs"></param>
        /// <param name="onMap"></param>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <returns>the error message or null</returns>
        public static string Desc(Player player, Dictionary <string, string> reqs)
        {
            foreach (KeyValuePair <string, string> req in reqs)
            {
                BaseReq br = OLib.GetReq(req.Key);

                //can use it?
                if (!br.Check(player, req.Value))
                {
                    return(br.Desc(player, req.Value));
                }
            }

            return(null);
        }
Exemple #9
0
        /// <summary>
        /// Return the description, why the check its not working or null
        /// </summary>
        /// <param name="player"></param>
        /// <param name="reqs"></param>
        /// <param name="onMap"></param>
        /// <param name="pos"></param>
        /// <returns>the error message or null</returns>
        public static string Desc(Player player, Dictionary <string, string> reqs, MapElementInfo onMap, NVector pos)
        {
            foreach (KeyValuePair <string, string> req in reqs)
            {
                BaseReq br = OLib.GetReq(req.Key);

                //can use it?
                if (!br.Check(player, onMap, req.Value, pos))
                {
                    return(br.Desc(player, onMap, req.Value, pos));
                }
            }

            return(null);
        }
Exemple #10
0
        /// <summary>
        /// Return the description, why the check its not working or null
        /// </summary>
        /// <param name="player"></param>
        /// <param name="reqs"></param>
        /// <param name="onMap"></param>
        /// <param name="pos"></param>
        /// <returns>the error message or null</returns>
        public string Desc(Player player, MapElementInfo onMap, NVector pos)
        {
            foreach (var req in reqs)
            {
                BaseReq br = OLib.GetReq(req[0]);

                //can use it?
                if (!br.Check(player, onMap, req[1], pos))
                {
                    return(br.Desc(player, onMap, req[1], pos));
                }
            }

            return(null);
        }
Exemple #11
0
        /// <summary>
        /// Return the description, why the check its not working
        /// </summary>
        /// <param name="player"></param>
        /// <returns>the error message or null</returns>
        public string Desc(Player player)
        {
            foreach (var req in reqs)
            {
                BaseReq br = OLib.GetReq(req[0]);

                //can use it?
                if (!br.Check(player, req[1]))
                {
                    return(br.Desc(player, req[1]));
                }
            }

            return(null);
        }
Exemple #12
0
        public void AddReq(string title, Dictionary <string, string> reqs)
        {
            //addHeader
            if (reqs.Count == 0)
            {
                return;
            }

            AddHeaderLabel(title);

            //add req
            foreach (KeyValuePair <string, string> req in reqs)
            {
                AddLabel(OLib.GetReq(req.Key).Desc(null, req.Value));
            }
        }
Exemple #13
0
        public void AddReqCheck(string title, Dictionary <string, string> reqs)
        {
            //addHeader
            if (reqs.Count == 0)
            {
                return;
            }

            AddHeaderLabel(title);

            //add req
            foreach (KeyValuePair <string, string> req in reqs)
            {
                BaseReq r = OLib.GetReq(req.Key);
                AddImageLabel(r.Desc(null, req.Value), r.Check(S.ActPlayer(), req.Value) ? "ui:yes" : "ui:no");
            }
        }
Exemple #14
0
        public void BuildPanel(PanelBuilder panel, string title, MapElementInfo onMap, NVector pos)
        {
            try
            {
                //addHeader
                if (reqs.Count == 0)
                {
                    return;
                }

                panel.AddHeaderLabel(title);

                //add req
                foreach (var req in reqs)
                {
                    BaseReq r = OLib.GetReq(req[0]);
                    panel.AddImageLabel(r.Desc(S.ActPlayer(), onMap, req[1], pos), r.Check(S.ActPlayer(), onMap, req[1], pos));
                }
            }
            catch (Exception e)
            {
                ExceptionHelper.ShowException(e);
            }
        }