Esempio n. 1
0
    public TileGeneration GetTile()
    {
        if (_debugField == null)
        {
            _debugField = FindObjectOfType <DebugField>();
        }

        _debugField.ShowDebugText("in Get tile");

        var            tilesThatAtPool = _tilePool.Where(t => t.IsInThePool == true).ToArray();
        TileGeneration tile;

        try
        {
            tile = tilesThatAtPool[Random.Range(0, tilesThatAtPool.Length)];
        }
        catch (IndexOutOfRangeException)
        {
            Debug.Log("");
            return(null);
        }

        tile.IsInThePool = false;
        return(tile);
    }
Esempio n. 2
0
        public static void Draw <TLeaf>(this HierarchicalTree <TLeaf> tree, bool drawSettings = true)
            where TLeaf : IHierarchicalTreeLeaf
        {
            if (!drawSettings || ImGui.CollapsingHeader($"Hierarchical Tree"))
            {
                var branchName = (DebugField <string>) "branchName";
                var branches   = (DebugField <Dictionary <string, HierarchicalTree <TLeaf> > >) "branches";
                var leaves     = (DebugField <HashSet <TreeLeaf <IHierarchicalTreeLeaf> > >) "leaves";

                DebugField.SetOwner(tree, branchName, branches, leaves);

                if (drawSettings)
                {
                    var settings = (DebugField <HierarchicalTreeSettingsData>)(tree, "settings");
                    if (!settings.AssertDrawable(branchName, branches, leaves))
                    {
                        return;
                    }

                    var folderRegex = (DebugField <Regex>) "folderRegex" + settings.Value;
                    if (drawSettings && folderRegex.AssertDrawable())
                    {
                        ImGui.Text($"Settings: {folderRegex.Value.ToString()}");
                        ImGui.Separator();
                    }
                }

                using (var branchNode = ImGuiUn.ScopeTreeNode(branchName.Value))
                {
                    if (!branchNode.IsOpen)
                    {
                        return;
                    }

                    if (branches.Value != null)
                    {
                        foreach (var branch in branches.Value.Values)
                        {
                            branch.Draw(false);
                        }
                    }

                    if (leaves.Value != null)
                    {
                        using (var leafNode = branches.Value != null ? ImGuiUn.ScopeTreeNode(leaves.Name) : null)
                        {
                            if (leafNode != null && !leafNode.IsOpen)
                            {
                                return;
                            }

                            foreach (var leaf in leaves.Value)
                            {
                                ImGui.Text($"- {leaf.Name}{leaf.Extension}{(leaf.LeafData.Size < 0 ? string.Empty : $" ({leaf.LeafData.Size.ToReadableSize()})")}");
                            }
                        }
                    }
                }
            }
        }
Esempio n. 3
0
 public ModifiersDebugField(ModifierCollection mods, string idStr)
 {
     this.mods     = mods;
     this.idStr    = idStr;
     this.oldState = mods.ToBitfield();
     this.field    = new DebugField();
 }
Esempio n. 4
0
        public static bool DrawHeader(this DebugField field, string text)
        {
            if (!field.AssertDrawable())
            {
                return(false);
            }

            return(ImGui.CollapsingHeader(text));
        }
Esempio n. 5
0
        internal void SetOwner(DebugMenu.IDebugMenuOwner owner)
        {
            if (this.owner == null)
            {
                this.owner = owner;

                DebugField.SetOwnerToAllDebugFields(this, owner);

                ManualInit();
            }
        }
Esempio n. 6
0
        public static bool AssertDrawable(this DebugField field)
        {
            if (field.IsValid)
            {
                return(true);
            }

            ImGui.TextColored(Color.red, $"Debug field '{field.Name}' is invalid !");

            return(false);
        }
Esempio n. 7
0
 private void Awake()
 {
     _debugField = FindObjectOfType <DebugField>();
     _debugField.ShowDebugText("awake in level Constructor");
     //Time.timeScale = 1;
     //GenerateLevel(_startTile);
     //_currentTiles = new List<ITile>();
     //_currentTiles.Add(_startTile);
     //_pool = FindObjectOfType<MapElementPool>();
     //_fogConstructor = GetComponent<FogConstructor>();
     //_enemiesConstructor = GetComponent<EnemiesConstructor>();
 }
Esempio n. 8
0
    /// <summary>
    /// Check debugging status for ScriptableObject if you have one in stored in class
    /// Use singleton to call this
    /// </summary>
    /// <param name="field">DebugField scriptable object contains bool debug ON/OFF</param>
    /// <returns></returns>
    public bool IsDebugging(DebugField field)
    {
        for (int i = 0; i < debugFields.Length; i++)
        {
            Debug.Log(debugFields[i].name);

            if (field == debugFields[i])
            {
                return(debugFields[i].enableDebug);
            }
        }

        return(false);
    }
Esempio n. 9
0
        public static bool AssertDrawable(this DebugField field, params DebugField[] fields)
        {
            bool allValid = true;

            for (int f = 0; f < fields.Length + Const.ONE_ITEM; f++)
            {
                var target = f == 0 ? field : fields[f - 1];
                if (!target.IsValid)
                {
                    allValid = false;
                    ImGui.TextColored(Color.red, $"Debug field '{target.Name}' is invalid !");
                }
            }

            return(allValid);
        }
Esempio n. 10
0
 protected override void ManualInit()
 {
     states = "states";
 }
Esempio n. 11
0
 public DelegateStateMachineSection(string stateMachineFieldName = STATEMACHINE_FIELD)
     : base($"State machine <{typeof(TTrigger).Name}>")
 {
     stateMachine = stateMachineFieldName;
 }
Esempio n. 12
0
        protected override void ManualInit()
        {
            base.ManualInit();

            connections = "connections";
        }