public MethodInfo GetMethod(Type Cl, string M, params string[] T)
    {
        MethodInfo MI       = null;
        string     DataName = Cl.FullName + "." + M;

        string[] RealName = T.Clone() as string[];
        for (int i = 0; i < RealName.Length; i++)
        {
            RealName[i] = GetFullNameClass(RealName[i]);
        }
        //RealType=new Type[RealName.Length];  for (int i = 0; i < RealType.Length; i++) RealType[i]=Type.GetType(RealName[i]);
        int DataParams = RealName.Aggregate((X, x) => X = X + x).GetHashCode();
        SortedDictionary <int, MethodInfo> HelperDict = null;
        Dictionary <string, string>        GenericMap;

        if (!GenericMethodsMap.TryGetValue(DataName, out HelperDict))
        {
            HelperDict = new SortedDictionary <int, MethodInfo>();
            GenericMethodsMap.Add(DataName, HelperDict);
        }
        if (!HelperDict.TryGetValue(DataParams, out MI))
        {
            MI = GetOriginalMethod(Cl, M, out GenericMap, T);
            if (MI != null)
            {
                MI = GetGenericMethod(MI, GenericMap.Select(d => d.Value).ToArray());
                HelperDict.Add(DataParams, MI);
            }
        }
        return(MI);
    }
Exemple #2
0
        /// <summary>
        ///   Validates that mappings have a one-to-one relationship.
        /// </summary>
        /// <exception cref="InvalidOperationException">The maps don't have a one-to-one relationship.</exception>
        private void ValidateMappings()
        {
            if (Component.Generics.Count != GenericMap.Count)
            {
                throw new InvalidOperationException(string.Format
                                                    (
                                                        "The sub-module ({0}), does not have the same amount of generic maps ({1}) as the associated component's ({2}) generics ({3}).",
                                                        Name,
                                                        GenericMap.Count.ToString(),
                                                        Component.Name,
                                                        Component.Generics.Count.ToString()
                                                    ));
            }

            foreach (SimplifiedGenericInfo info in Component.Generics)
            {
                if (!GenericMap.ContainsKey(info))
                {
                    throw new InvalidOperationException(string.Format
                                                        (
                                                            "The sub-module ({0}), does not have a mapping for a generic ({1}) in the associated component ({2}).",
                                                            Name,
                                                            info.Name,
                                                            Component.Name
                                                        ));
                }
            }

            if (Component.Ports.Count != PortMap.Count)
            {
                throw new InvalidOperationException(string.Format
                                                    (
                                                        "The sub-module ({0}), does not have the same amount of port maps ({1}) as the associated component's ({2}) ports ({3}).",
                                                        Name,
                                                        PortMap.Count.ToString(),
                                                        Component.Name,
                                                        Component.Ports.Count.ToString()
                                                    ));
            }

            foreach (SimplifiedPortInfo info in Component.Ports)
            {
                if (!PortMap.ContainsKey(info))
                {
                    throw new InvalidOperationException(string.Format
                                                        (
                                                            "The sub-module ({0}), does not have a mapping for a port ({1}) in the associated component ({2}).",
                                                            Name,
                                                            info.Name,
                                                            Component.Name
                                                        ));
                }
            }
        }
            public GenericMap()
            {
                m_info = ViveRoleEnum.GetInfo <TRole>();
                m_map  = GetInternalMap(typeof(TRole));

                if (s_instance == null)
                {
                    s_instance = this;
                }
                else
                {
                    UnityEngine.Debug.LogWarning("duplicated instance for RoleInfo<" + typeof(TRole).Name + ">");
                }
            }
Exemple #4
0
            public GenericMap()
            {
                m_info = ViveRoleEnum.GetInfo <TRole>();
                m_map  = GetInternalMap(typeof(TRole));

                if (s_instance == null)
                {
                    s_instance = this;
                }
                else
                {
                    Debug.LogWarning("duplicated instance for RoleInfo<" + typeof(TRole).Name + ">");
                }

                m_map.onRoleValueMappingChanged += OnMappingChanged;
            }
    // Use this for initialization
    void Start()
    {
        //オブジェクトのInstantiate
        enemy = Instantiate(enemy, new Vector3(enemyPos.x, 0, enemyPos.y), Quaternion.identity);
        item  = Instantiate(item, new Vector3(itemPos.x, 0, itemPos.y), Quaternion.identity);

        //mapGeneratorのインスタンス格納、変数、配列の読み込み
        MapooGenerator mapooGenerator = gameObject.GetComponent <MapooGenerator>();

        _passableMap = new GenericMap <bool>(mapooGenerator.passableMap);
        terrains     = mapooGenerator.terrains;
        mapRange     = mapooGenerator.mapRange;

        //結果を格納する行列を初期化
        map = new float[mapRange.x, mapRange.y];

        //影響マップスクリプトのインスタンス生成
        influenceMap = new InfluenceMap(mapRange.x, mapRange.y);
    }
Exemple #6
0
 public MapHandler()
 {
     m_map = GetInternalMap <TRole>();
 }
        private bool setupPunishmentsAndTripWires()
        {
            string MemMapName = Program.GameData.MatchInfo.MapName;

            if (MemMapName == null || MemMapName == "" || MemMapName.ToLower().Contains("de_") == false)
            {
                Log.AddEntry(new LogEntry()
                {
                    LogTypes = new List <LogTypes> {
                        LogTypes.Analytics
                    },
                    AnalyticsCategory = "Error",
                    AnalyticsAction   = "InvalidMapName",
                    AnalyticsLabel    = MemMapName
                });
                return(false); // Fail
            }

            ClientState        = 6;
            HasConnectedToGame = true;
            ActiveMapName      = MemMapName;
            string MatchID = Program.GameData.MatchInfo.MatchID;

            if (MatchID != null)
            {
                Log.AddEntry(new LogEntry()
                {
                    LogTypes = new List <LogTypes> {
                        LogTypes.Analytics
                    },
                    AnalyticsCategory = "MatchID",
                    AnalyticsAction   = MatchID
                });
            }

            // Start recording
            Program.FakeCheat.ReplayMonitor.StartRecording();

            Type MapClass = Type.GetType("ScriptKidAntiCheat." + ActiveMapName);

            if (MapClass != null)
            {
                ActiveMapClass = (Map)Activator.CreateInstance(MapClass);
            }
            else
            {
                ActiveMapClass = new GenericMap();
            }

            Console.WriteLine(ActiveMapName);

            if (ActiveMapClass != null)
            {
                Log.AddEntry(new LogEntry()
                {
                    LogTypes = new List <LogTypes> {
                        LogTypes.Analytics
                    },
                    AnalyticsCategory = "MapLoads",
                    AnalyticsAction   = ActiveMapName
                });
            }

            return(true); // Success
        }