Example #1
0
    public static Dictionary <TK, TV> GetNodeMap <TK, TV>(this Node gdNode,
                                                          Node caller, Dictionary <TK, NodePath> nodePathMap) where TV : Godot.Object
    {
        Dictionary <TK, TV> nodeMap = new Dictionary <TK, TV>();

        if (nodePathMap != null)
        {
            TV value;

            SCG.IEnumerator <SCG.KeyValuePair <TK, NodePath> > it =
                nodePathMap.GetEnumerator();

            while (it.MoveNext())
            {
                value = caller.GetNode <TV>(it.Current.Value);

                if (value != null)
                {
                    nodeMap.Add(it.Current.Key, value);
                }
            }
        }
        else
        {
            GD.PushWarning("NodePathMap called by '" + caller.Name + "' is null");
        }

        return(nodeMap);
    }
Example #2
0
 public void Init()
 {
     dict      = new HashDictionary <string, string>();
     dict["S"] = "A";
     dict["T"] = "B";
     dict["R"] = "C";
     dictenum  = dict.GetEnumerator();
 }
Example #3
0
    private void UpdateButtonsTextToCurrentMapping()
    {
        SCG.IEnumerator <SCG.KeyValuePair <object, Button> > it =
            buttonMap.GetEnumerator();

        while (it.MoveNext())
        {
            SetButtonText(it.Current.Key);
        }
    }
Example #4
0
    public void Put <TK, TV>(Dictionary <TK, TV> map)
    {
        SCG.IEnumerator <SCG.KeyValuePair <TK, TV> > it =
            map.GetEnumerator();

        while (it.MoveNext())
        {
            Put(it.Current.Key, it.Current.Value);
        }
    }
Example #5
0
 public void Init()
 {
     dict = new TreeDictionary <string, string>(new SC())
     {
         ["S"] = "A",
         ["T"] = "B",
         ["R"] = "C"
     };
     dictenum = dict.GetEnumerator();
 }
Example #6
0
    public void Put(Dictionary <string, object> map)
    {
        SCG.IEnumerator <SCG.KeyValuePair <string, object> > it =
            map.GetEnumerator();

        while (it.MoveNext())
        {
            Put(it.Current.Key, it.Current.Value);
        }
    }
Example #7
0
    public void GetAllAsList(Godot.Object optional)
    {
        Array list = new Array();

        SCG.IEnumerator <SCG.KeyValuePair <string, object> > it =
            globalDataMap.GetEnumerator();

        while (it.MoveNext())
        {
            list.Add(it.Current.Value);
        }

        optional.Call(this.GetMethodSet(), list);
    }
    public static Dictionary ConvertToDefaultMap <TK, TV>(
        this Godot.Object gdobj, Dictionary <TK, TV> map)
    {
        Dictionary defaultMap = new Dictionary();

        if (map != null)
        {
            SCG.IEnumerator <SCG.KeyValuePair <TK, TV> > it = map.GetEnumerator();

            while (it.MoveNext())
            {
                defaultMap.Add(it.Current.Key, it.Current.Value);
            }
        }

        return(defaultMap);
    }
Example #9
0
    private void DeactivateAllCheatCodes()
    {
        GD.PushWarning("Deactivating all cheat codes!");
        Array  dataList;
        object dataKey;
        object dataValue;

        SCG.IEnumerator <SCG.KeyValuePair <string, Array> > it
            = cheatCodeDataMap.GetEnumerator();

        while (it.MoveNext())
        {
            dataList  = it.Current.Value;
            dataKey   = dataList[0];
            dataValue = dataList[1];
            target.Call(this.GetMethodOnToggleCheatCode(),
                        dataKey, dataValue, false);
        }
    }
Example #10
0
    public static TK[] ConvertKeysToArray <TK, TV>(
        this Godot.Object gdobj, Dictionary <TK, TV> map)
    {
        if (map != null)
        {
            int  index = 0;
            TK[] array = new TK[map.Count];
            SCG.IEnumerator <SCG.KeyValuePair <TK, TV> > it = map.GetEnumerator();

            while (it.MoveNext())
            {
                array[index++] = it.Current.Key;
            }

            return(array);
        }

        return(new TK[0]);
    }
Example #11
0
 public void Dispose()
 {
     dictenum = null;
     dict     = null;
 }