コード例 #1
0
 public OverwatchPropWrapper(ushort parentAssetId, int propIndex, PropInfo propInfo)
 {
     ParentAssetId = parentAssetId;
     PropIndex = propIndex;
     SourcePackageId = ParsePackageId(propInfo);
     TechnicalName = propInfo.name;
 }
コード例 #2
0
 public ConventionInfo()
 {
     Source = new TypeInfo();
     Target = new TypeInfo();
     SourceProp = new PropInfo();
     TargetProp = new PropInfo();
 }
コード例 #3
0
 private ulong ParsePackageId(PropInfo propInfo)
 {
     ulong result = 0;
     var match = Regex.Match(propInfo.name, RegexExpression.PackageId);
     if (match.Success && !string.IsNullOrEmpty(match.Value))
         result = ulong.Parse(match.Value);
     return result;
 }
コード例 #4
0
ファイル: OrderRequest.cs プロジェクト: Qurrex/matchingui
        static OrderRequest()
        {
            OrderRequest r = null;

            StructSize =
                16             // RequestId
                + 16           // ClearingAccountId
                + 16           // TraderAccountId
                + PropInfo.GetSize(r, o => o.InstrumentId)
                + sizeof(byte) // OrderType
                + sizeof(byte) // TimeInForce
                + sizeof(byte) // OrderSide
                + sizeof(byte) // AutoCancel
                + PropInfo.GetSize(r, o => o.Amount)
                + PropInfo.GetSize(r, o => o.Price)
                + PropInfo.GetSize(r, o => o.Flags)
                + 16; // comment
        }
コード例 #5
0
ファイル: PropDescPart.cs プロジェクト: ErrorMee/update
    void OnEnable()
    {
        EventTriggerListener.Get(closeBtn.gameObject).onClick   = OnCloseClick;
        EventTriggerListener.Get(closeTrans.gameObject).onClick = OnCloseClick;
        EventTriggerListener.Get(sureBtn.gameObject).onClick    = OnSureClick;
        PropInfo propInfo = PropModel.Instance.crtProp;

        if (propInfo != null)
        {
            titel.text               = LanguageUtil.GetTxt(Convert.ToInt32(propInfo.config.name));
            content.text             = LanguageUtil.GetTxt(Convert.ToInt32(propInfo.config.desc));
            showImage.overrideSprite = GameMgr.resourceMgr.GetSprite("icon/prop.ab", "prop_" + propInfo.config.icon);
        }

        winOpenAnim.Play();

        PlayerModel.Instance.updateWealthsEvent += UpdateView;
    }
コード例 #6
0
        private static PersistenceModelPropertiesDescription GetTestModelDescription()
        {
            var joinedModels = new[] { PropInfo.FromPropertyExpression <Order>(v => v.Customer) };
            var components   = new[] {
                PropInfo.FromPropertyExpression <Order>(v => v.PaymentInfo),
                PropInfo.FromPropertyExpression <Order>(v => v.AuditInfo)
            };
            var simpleProps = new[] {
                PropInfo.FromPropertyExpression <Order>(v => v.Id),
                PropInfo.FromPropertyExpression <Order>(v => v.Type),
                PropInfo.FromPropertyExpression <Order>(v => v.OrderDate),
                PropInfo.FromPropertyExpression <Order>(v => v.TotalPrice),
                PropInfo.FromPropertyExpression <Order>(v => v.Note),
                PropInfo.FromPropertyExpression <Order>(v => v.ItemsCount),
            };

            return(new PersistenceModelPropertiesDescription(simpleProps, components, joinedModels));
        }
コード例 #7
0
 /// <summary>
 /// SaveProp
 /// </summary>
 /// <returns></returns>
 public bool SaveProp(PropInfo propInfo, ref string error)
 {
     if (CheckProp(propInfo.Prop_Id))
     {
         UpdateProp(propInfo);
         return(true);
     }
     else
     {
         if (CheckProp(propInfo))//判断在同一个父类下面,是不是有这个属性代码了。
         {
             error = "属性代码已存在";
             return(false);
         }
         AddProp(propInfo);
         return(true);
     }
 }
コード例 #8
0
            public PropStringVals(Model model, PropInfo prop)
            {
                AllowNull      = prop.IsRequired ? "false" : "true";
                CheckMinLength = prop.CheckMinLength ? "true" : "false";
                CheckMaxLength = prop.CheckMaxLength ? "true" : "false";
                PropName       = "entity." + prop.Name;

                if (prop.DataType == typeof(DateTime))
                {
                    Min = prop.CheckMinLength ? "DateTime.Parse(" + prop.MinLength + ");" : "DateTime.MinValue";
                    Max = prop.CheckMaxLength ? "DateTime.Parse(" + prop.MaxLength + ");" : "DateTime.MaxValue";
                }
                else
                {
                    Min = GetLength(prop.CheckMinLength, prop.MinLength, "-1");
                    Max = GetLength(prop.CheckMaxLength, prop.MaxLength, "-1");
                }
            }
コード例 #9
0
ファイル: PropService.cs プロジェクト: radtek/CustomerManage
 /// <summary>
 /// 获取某个节点的详细信息
 /// </summary>
 /// <param name="loggingSessionInfo">登录Model</param>
 /// <param name="propId">节点标识</param>
 /// <returns></returns>
 public PropInfo GetPropInfoById(string propId)
 {
     try
     {
         PropInfo propInfo = new PropInfo();
         DataSet  ds       = new DataSet();
         ds = propService.GetPropInfoById(propId);
         if (ds != null && ds.Tables != null && ds.Tables[0].Rows.Count > 0)
         {
             propInfo = DataTableToObject.ConvertToObject <PropInfo>(ds.Tables[0].Rows[0]);
         }
         return(propInfo);
     }
     catch (Exception ex)
     {
         throw (ex);
     }
 }
コード例 #10
0
        public static PropInfo[] GetProps(object obj)
        {
            BindingFlags    bindingAttr = BindingFlags.Public | BindingFlags.Instance;
            Type            type        = obj.GetType();
            List <PropInfo> list        = new List <PropInfo>();

            foreach (PropertyInfo info in type.GetProperties(bindingAttr))
            {
                list.Add(new PropInfo(obj, info));
            }
            foreach (FieldInfo info2 in type.GetFields(bindingAttr))
            {
                list.Add(new PropInfo(obj, info2));
            }
            PropInfo[] array = new PropInfo[list.Count];
            list.CopyTo(array);
            return(array);
        }
コード例 #11
0
        private static void CheckOverlap(ref PropInstance prop, ushort propID) //this method reproduces original code for most part to prevent exceptions
        {
            PropInfo info = prop.Info;

            if (info == null)
            {
                return;
            }
            ItemClass.CollisionType collisionType = ((int)prop.m_flags & 32) != 0 ? ItemClass.CollisionType.Elevated : ItemClass.CollisionType.Terrain;
            Randomizer randomizer = new Randomizer((int)propID);
            float      num1       = info.m_minScale + (float)((double)randomizer.Int32(10000U) * ((double)info.m_maxScale - (double)info.m_minScale) * 9.99999974737875E-05);
            float      num2       = info.m_generatedInfo.m_size.y * num1;
            Vector3    position   = prop.Position;
            float      minY       = position.y;
            float      maxY       = position.y + num2;
            float      num3       = !prop.Single ? 4.5f : 0.3f;
            Quad2      quad       = new Quad2();
            Vector2    vector2    = VectorUtils.XZ(position);

            quad.a = vector2 + new Vector2(-num3, -num3);
            quad.b = vector2 + new Vector2(-num3, num3);
            quad.c = vector2 + new Vector2(num3, num3);
            quad.d = vector2 + new Vector2(num3, -num3);
            bool flag = false;

            if (info.m_class != null)
            {
                if (Singleton <NetManager> .instance.OverlapQuad(quad, minY, maxY, collisionType, info.m_class.m_layer, (ushort)0, (ushort)0, (ushort)0))
                {
                    flag = true;
                }
                if (Singleton <BuildingManager> .instance.OverlapQuad(quad, minY, maxY, collisionType, info.m_class.m_layer, (ushort)0, (ushort)0, (ushort)0))
                {
                    flag = true;
                }
            }
            //begin mod
            if (!OptionsWrapper <Options> .Options.unhideAllPropsOnLevelLoading)
            {
                return;
            }
            prop.Blocked = false;
            //end mod
        }
コード例 #12
0
        //when collapsing the full property the "field" line is not removed

        public string EmittFullPropertyTemplated(string template, PropInfo info)
        {
            var code = new StringBuilder();

            Action <int, string> AppendLine = (indent, line) =>
            {
                code.Append(info.RootIndent);

                for (int i = 0; i < indent; i++)
                {
                    code.Append("    ");
                }
                code.AppendLine(line);
            };

            string fieldName = info.Name[0].ToString().ToLower() + info.Name.Substring(1);

            var lines = template.Replace("\r\n", "\n").Split('\n').ToArray();

            for (int i = 0; i < lines.Length; i++)
            {
                var line = lines[i];
                if (line.Contains("${type}") && line.Contains("${fieldName};")) //backing field
                {
                    lines[i] = line.Replace("${fieldName};", "${fieldName}${initValue};");
                }
            }

            template = string.Join(Environment.NewLine, lines);

            string retval = template.Replace("${type}", info.AccessModifiers.Split(" \t".ToCharArray()).Last(0))
                            .Replace("${fieldName}", fieldName)
                            .Replace("${initValue}", info.InitialValue)
                            .Replace("${propName}", info.Name)
                            .Replace("${fieldName}", fieldName)
                            .Replace(";;", ";");         //initValue may contain ';' as well as the template so remove duplicates

            foreach (string line in retval.Split(new string[] { "\r\n" }, StringSplitOptions.None))
            {
                AppendLine(0, line);
            }

            return(code.ToString());
        }
コード例 #13
0
        public SegmentData(SegmentData segmentData)
        {
            if (segmentData == null)
            {
                return;
            }

            Features        = segmentData.Features;
            TreeLeft        = segmentData.TreeLeft;
            TreeMiddle      = segmentData.TreeMiddle;
            TreeRight       = segmentData.TreeRight;
            StreetLight     = segmentData.StreetLight;
            RepeatDistances = segmentData.RepeatDistances;

            TreeLeftPrefab   = segmentData.TreeLeftPrefab;
            TreeMiddlePrefab = segmentData.TreeMiddlePrefab;
            TreeRightPrefab  = segmentData.TreeRightPrefab;
            PillarPrefab     = segmentData.PillarPrefab;
        }
コード例 #14
0
        public static bool IsStreetLightProp(PropInfo prefab)
        {
            if (prefab == null)
            {
                return(false);
            }

            if (prefab.m_class.m_service == ItemClass.Service.Road ||
                prefab.m_class.m_subService == ItemClass.SubService.PublicTransportPlane ||
                prefab.name.ToLower().Contains("streetlamp") ||
                prefab.name.ToLower().Contains("streetlight") ||
                prefab.name.ToLower().Contains("lantern") ||
                prefab.name.ToLower().Contains("street light"))
            {
                if (prefab.m_effects != null && prefab.m_effects.Length > 0)
                {
                    if (prefab.name.ToLower().Contains("taxiway"))
                    {
                        return(false);
                    }
                    if (prefab.name.ToLower().Contains("runway"))
                    {
                        return(false);
                    }

                    // American highway signs with integrated lights are NOT street lights!
                    if (prefab.name.StartsWith(AmericanSignReplacerWorkshopId))
                    {
                        return(false);
                    }

                    foreach (var effect in prefab.m_effects)
                    {
                        if (effect.m_effect is LightEffect)
                        {
                            return(true);
                        }
                    }
                }
            }

            return(false);
        }
コード例 #15
0
        public static bool Prefix(ref PropInfo info, ref Vector3 position, ref float angle, ref bool single)
        {
            if (!(Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)))
            {
                return(true);
            }
            else
            {
#if DEBUG
                string str = String.Format("Invoking prop at:{0}, angle:{1}, info:{2}", position, angle, info.GetLocalizedTitle());
                LoggerUtils.Log(str);
#endif
                PropUnlimiterManager.instance.SetUnlimitedProp(info.m_prefabDataIndex, position, angle, single);
                PropTool.DispatchPlacementEffect(position, true);
                PropManager.instance.UpdateProp(0);
                PropManager.instance.UpdatePropRenderer(0, true);
                return(false);
            }
        }
コード例 #16
0
        public void SetValue(object newValueAsObject)
        {
            if (IsAccessDisallowed)
            {
                return;
            }

            var newValue = ToCongruentObject(newValueAsObject);

            if (!ConstraintChecker.IsWithinConstraints(newValue))
            {
                var message = string.Format("For '{0}', provided value ('{1}') is not within required constraints {2}.",
                                            Name, newValue, ConstraintChecker.Description);
                QBCLog.Error(message);
                throw new ArgumentException(message);
            }

            PropInfo.SetValue(SettingsInstance, newValue, null);
        }
コード例 #17
0
        public static Deal ReadFromBuffer(ByteBuffer buf, int offset = 0)
        {
            var d = new Deal();

            if (buf.length - offset < StructSize)
            {
                return(d);
            }
            d.DealId = BitConverter.ToInt64(buf.data, offset);
            offset  += PropInfo.GetSize(d, r => r.DealId);

            d.Price = BitConverter.ToInt64(buf.data, offset);
            offset += PropInfo.GetSize(d, r => r.Price);

            d.Amount = BitConverter.ToInt64(buf.data, offset);
            offset  += PropInfo.GetSize(d, r => r.Amount);

            return(d);
        }
コード例 #18
0
ファイル: Util.cs プロジェクト: kianzarrin/CS-PropLineTool
        public static bool IsMeshCenterOffset(this PropInfo prop, bool constrainToXZ, out Vector3 centerCorrectionOrthogonal)
        {
            centerCorrectionOrthogonal = Vector3.zero;

            Mesh _mesh = prop.m_mesh;

            if (_mesh == null)
            {
                return(false);
            }
            Bounds _bounds = _mesh.bounds;

            Vector3 _center = _bounds.center;
            Vector3 _size   = _bounds.size;

            bool _result = IsCenterAreaSignificant(_center, _size, constrainToXZ, out centerCorrectionOrthogonal);

            return(_result);
        }
コード例 #19
0
        /// <summary>
        /// Creates and instantiates a copy of a PropInfo
        /// </summary>
        public static PropInfo InstantiatePropCopy(PropInfo template)
        {
            if (template == null)
            {
                return(null);
            }

            PropInfo copyInfo = GameObject.Instantiate(template);

            copyInfo.name = template.name;
            copyInfo.gameObject.SetActive(false);

            // Create generated info
            copyInfo.m_generatedInfo            = ScriptableObject.CreateInstance <PropInfoGen>();
            copyInfo.m_generatedInfo.name       = copyInfo.name;
            copyInfo.m_generatedInfo.m_propInfo = copyInfo;
            copyInfo.CalculateGeneratedInfo();

            // Create LOD object
            if (template.m_lodObject != null)
            {
                GameObject copyLod = GameObject.Instantiate(template.m_lodObject);
                copyLod.SetActive(false);
                // Set sharedmaterial
                Renderer lodRenderer = copyLod.GetComponent <Renderer>();
                if (lodRenderer != null)
                {
                    lodRenderer.sharedMaterial = lodRenderer.material;
                }
                copyInfo.m_lodObject = copyLod;
            }

            // Set sharedmaterial
            Renderer r = copyInfo.GetComponent <Renderer>();

            if (r != null)
            {
                r.sharedMaterial = r.material;
            }
            copyInfo.InitializePrefab();
            copyInfo.m_prefabInitialized = true;
            return(copyInfo);
        }
コード例 #20
0
ファイル: PrefabLoader.cs プロジェクト: JCCZ01/Loading2.0
        bool Skip(PropInfo info)
        {
            string name = info.name;

            if (keptProps.Contains(name))
            {
                return(false);
            }

            if (skippedPrefabs[PROPS].Contains(name))
            {
                return(true);
            }

            bool skip = Skip(info, PROPS);

            (skip ? skippedPrefabs[PROPS] : keptProps).Add(name);
            return(skip);
        }
コード例 #21
0
        public static void SetAsTunnelLightProp(this PropInfo thePropInfo, float intensity, float range)
        {
            //var effectInfo = EffectCollection.Effects.FirstOrDefault(e=> e.name == "Runway Light").ShallowClone();
            var lightEffect = Resources.FindObjectsOfTypeAll <LightEffect>().FirstOrDefault(l => l.name == "Runway Light").ShallowClone();

            lightEffect.SetLightField("m_lightIntensity", intensity);
            lightEffect.SetLightField("m_lightRange", range);

            var effectList = new List <PropInfo.Effect>();

            for (int i = 0; i < thePropInfo.m_effects.Count(); i++)
            {
                var effect = thePropInfo.m_effects[i].ShallowClone();
                effect.m_effect   = lightEffect;
                effect.m_position = Vector3.zero;
                effectList.Add(effect);
            }
            thePropInfo.m_effects = effectList.ToArray();
        }
コード例 #22
0
        private static PropInfo Clone(PropInfo prop, Flag modification, bool isWall)
        {
            var gameObject = GameObject.Find("MoreFlags") ?? new GameObject("MoreFlags");
            var collection = gameObject.GetComponent <FlagsCollection>() ?? gameObject.AddComponent <FlagsCollection>();
            var instance   = Object.Instantiate(prop.gameObject);
            var clone      = instance.GetComponent <PropInfo>();
            var name       = $"{prop.name}_{modification.id}";

            clone.name                = name;
            instance.name             = name;
            instance.transform.parent = gameObject.transform;
            clone.GetComponent <Renderer>().material.mainTexture = modification.texture;
            clone.GetComponent <Renderer>().material.name        = $"{prop.GetComponent<Renderer>().material.name}_{modification.id}";
            clone.m_lodObject = Object.Instantiate(prop.m_lodObject);
            clone.m_lodObject.transform.parent = instance.transform;
            clone.m_lodObject.name             = prop.m_lodObject.name + $"_{modification.id}";
            var renderer = clone.m_lodObject.GetComponent <MeshRenderer>();

            Object.DestroyImmediate(renderer);
            renderer          = clone.m_lodObject.AddComponent <MeshRenderer>();
            renderer.material = new Material(prop.m_lodObject.GetComponent <Renderer>().sharedMaterial)
            {
                mainTexture = modification.textureLod,
                name        = $"{prop.m_lodObject.GetComponent<Renderer>().sharedMaterial.name}_{modification.id}"
            };
            clone.m_placementStyle   = ItemClass.Placement.Manual;
            clone.m_createRuining    = false;
            clone.m_Atlas            = Atlas;
            clone.m_InfoTooltipAtlas = Atlas;
            var thumb = isWall ? modification.thumbWall : modification.thumb;

            if (thumb != null)
            {
                clone.m_Thumbnail            = thumb.name;
                clone.m_InfoTooltipThumbnail = thumb.name;
            }
            PrefabCollection <PropInfo> .InitializePrefabs("MoreFlags", new[] { clone }, null);

            ApplyRenderDistanceHack(clone);
            AddLocale(modification, isWall, name);
            collection.flags.Add(clone);
            return(clone);
        }
コード例 #23
0
        public void DeleteProp()
        {
            const string uri      = "b.txt";
            const string prop     = "prop2";
            var          propInfo = new PropInfo {
                Prop = new XElement(prop)
            };

            PropertyManager.GetInstanse().AddProps(uri, new List <PropInfo> {
                propInfo
            });
            var name = PropertyManager.GetInstanse().GetLockInfo(uri).ElementAt(0).Prop.Name.LocalName;

            Assert.AreEqual(name, prop);
            PropertyManager.GetInstanse().Delete(uri, propInfo);
            var deletedInfo = PropertyManager.GetInstanse().GetLockInfo(uri).Count;

            Assert.AreEqual(0, deletedInfo);
        }
コード例 #24
0
ファイル: TVPropPatch.cs プロジェクト: sway2020/TVPropPatch
        public static bool Prefix(ref TreeInfo tree)
        {
            if (tree == null)
            {
                return(false);
            }
            if (Settings.skipVanillaTrees && !tree.m_isCustomContent)
            {
                return(false);
            }
            if (Mod.skippedTreeDictionary.ContainsKey(tree.name) && Mod.skippedTreeDictionary[tree.name])
            {
                return(false);
            }

            PropInfo propInfo = AssetExtension.CloneProp();

            propInfo.name                           = tree.name.Replace("_Data", "") + " Prop_Data";
            propInfo.m_mesh                         = tree.m_mesh;
            propInfo.m_material                     = tree.m_material;
            propInfo.m_Thumbnail                    = tree.m_Thumbnail;
            propInfo.m_InfoTooltipThumbnail         = tree.m_InfoTooltipThumbnail;
            propInfo.m_InfoTooltipAtlas             = tree.m_InfoTooltipAtlas;
            propInfo.m_Atlas                        = tree.m_Atlas;
            propInfo.m_generatedInfo.m_center       = tree.m_generatedInfo.m_center;
            propInfo.m_generatedInfo.m_uvmapArea    = tree.m_generatedInfo.m_uvmapArea;
            propInfo.m_generatedInfo.m_size         = tree.m_generatedInfo.m_size;
            propInfo.m_generatedInfo.m_triangleArea = tree.m_generatedInfo.m_triangleArea;
            propInfo.m_color0                       = tree.m_defaultColor;
            propInfo.m_color1                       = tree.m_defaultColor;
            propInfo.m_color2                       = tree.m_defaultColor;
            propInfo.m_color3                       = tree.m_defaultColor;
            CS_TreeProps.Mod.propToTreeCloneMap.Add(propInfo, tree);
            Mod.generatedTreeProp.Add(propInfo);

            if (!Mod.skippedTreeDictionary.ContainsKey(tree.name))
            {
                Settings.skippedTreeEntries.Add(new SkippedEntry(tree.name));
            }

            return(false);
        }
コード例 #25
0
        public string EmittFullPropertyHardcoded(PropInfo info)
        {
            var code = new StringBuilder();

            string fieldName = info.Name[0].ToString().ToLower() + info.Name.Substring(1);

            Action <int, string> AppendLine = (indent, line) =>
            {
                code.Append(info.RootIndent);

                for (int i = 0; i < indent; i++)
                {
                    code.Append("    ");
                }
                code.AppendLine(line);
            };

            AppendLine(0, info.AccessModifiers.Replace("public ", "")
                       .Replace("internal ", "")
                       .Replace("protected ", "")
                       + " " + fieldName + ";");
            code.AppendLine();
            AppendLine(0, info.AccessModifiers + " " + info.Name);
            AppendLine(0, "{");
            if (info.HasGetter)
            {
                AppendLine(1, info.GetterAccessModifiers == "" ? "get" : info.GetterAccessModifiers + " get");
                AppendLine(1, "{");
                AppendLine(2, "return " + fieldName + ";");
                AppendLine(1, "}");
            }
            if (info.HasSetter)
            {
                AppendLine(1, info.SetterAccessModifiers == "" ? "set" : info.SetterAccessModifiers + " set");
                AppendLine(1, "{");
                AppendLine(2, fieldName + " = value;");
                AppendLine(1, "}");
            }
            AppendLine(0, "}");

            return(code.ToString());
        }
コード例 #26
0
        public static PropInfo GetTunnelCatenary(PropInfo prop)
        {
            if (ParseR69RailwayTag(prop, out var type, out var styleName, out var subStyleName, out var variationName))
            {
                if (type == R69_QUAD_NORMAL)
                {
                    return(GetR69RailwayPropWithFallback(R69_QUAD_TUNNEL, styleName, subStyleName, variationName));
                }
                else if (type == R69_DOUBLE_NORMAL)
                {
                    return(GetR69RailwayPropWithFallback(R69_DOUBLE_TUNNEL, styleName, subStyleName, variationName));
                }
                else if (type == R69_SINGLE_NORMAL)
                {
                    return(GetR69RailwayPropWithFallback(R69_SINGLE_TUNNEL, styleName, subStyleName, variationName));
                }
            }

            return(null);
        }
コード例 #27
0
        protected override void OnToolUpdate()
        {
            PropInfo propInfo = this.m_propInfo;

            if (propInfo == null)
            {
                return;
            }

            if (Input.GetKeyDown(KeyCode.LeftArrow))
            {
                this.m_angle = (this.m_angle + 15f) % 360f;
                EventBusManager.Instance().Publish("setAngle", this.m_angle);
            }
            else if (Input.GetKeyDown(KeyCode.RightArrow))
            {
                this.m_angle = (this.m_angle - 15f) % 360f;
                EventBusManager.Instance().Publish("setAngle", this.m_angle);
            }
        }
コード例 #28
0
        public static int DumpPropsofString(NetInfo loadedPrefab, string findString)
        {
            Debug.Log("Standalone Method Fired");
            int num = 0;

            for (int i = 0; i < loadedPrefab.m_lanes.Length; i++)
            {
                NetLaneProps LaneJProps = loadedPrefab.m_lanes[i].m_laneProps;
                for (int j = 0; j < LaneJProps.m_props.Length; j++)
                {
                    PropInfo a = loadedPrefab.m_lanes[i].m_laneProps.m_props[j].m_prop;
                    if (a.name.Contains(findString))
                    {
                        DumpUtil.DumpMeshAndTextures(a.name, a.m_mesh, a.m_material);
                        num++;
                    }
                }
            }
            return(num);
        }
コード例 #29
0
        public void DumpProps()
        {
            //so far dumps all props in road - problem is that dumping the mesh for most props doesn't work since most are "unreadable" in ModTools
            //tried investigating getting mesh from the sharedassets11.assets file in /Cities_Data but can't figure out how to load the file directly into the mod

            //Open to any pointers in how to solve this, If you are reading this and know a way feel free to make a new issue in GitHub
            Debug.Log(loadedPrefab.m_lanes.Length + " Lanes Exist");
            for (int i = 0; i < loadedPrefab.m_lanes.Length; i++)
            {
                NetLaneProps LaneJProps = loadedPrefab.m_lanes[i].m_laneProps;
                Debug.Log("lane" + i + "props len: " + LaneJProps.m_props.Length);

                for (int j = 0; j < LaneJProps.m_props.Length; j++)
                {
                    PropInfo a = loadedPrefab.m_lanes[i].m_laneProps.m_props[j].m_prop;
                    Debug.Log(a.name);
                    DumpUtil.DumpMeshAndTextures(a.name, a.m_mesh, a.m_material);
                }
            }
        }
コード例 #30
0
        /// <summary>
        /// 根据指定的属性名称和类型,创建一个匿名类型。
        /// </summary>
        /// <param name="propNames">属性名称。</param>
        /// <param name="propTypes">属性类型。</param>
        /// <param name="baseType">基类类型。</param>
        /// <param name="interfaceTypes">实现的接口类型。</param>
        /// <param name="propertyReadonly">指定新创建的类型中的属性是否只读。</param>
        /// <returns>返回新创建的类型。</returns>
        public static Type CreateDynamicType(string[] propNames, Type[] propTypes, Type baseType = null, Type[] interfaceTypes = null, bool propertyReadonly = false)
        {
            var info = new DynamicTypeInfo {
                BaseType = baseType
            };

            for (var i = 0; i < propNames.Length; i++)
            {
                var propInfo = new PropInfo(propNames[i], propTypes[i]);
                if (!info.Properties.Contains(propInfo))
                {
                    info.Properties.Add(propInfo);
                }
            }
            if (interfaceTypes != null)
            {
                info.Interfaces.AddRange(interfaceTypes);
            }
            return(dynamicTypes[info, key => CreateDynamicTypeByTypeInfo(key, propertyReadonly)]);
        }
コード例 #31
0
    public void OnSelectChanged(bool select, PropInfo propInfo)
    {
        if (select)
        {
            crtProp = propInfo;
        }
        else
        {
            crtProp = null;
        }

        if (crtProp != null)
        {
            ChangePropStadus(PropStadus.select);
        }
        else
        {
            ChangePropStadus(PropStadus.unSelect);
        }
    }
コード例 #32
0
        public override void RenderOverlay(RenderManager.CameraInfo cameraInfo, Color toolColor, Color despawnColor)
        {
            if (!isValid)
            {
                return;
            }

            ushort      prop        = id.Prop;
            PropManager propManager = PropManager.instance;
            PropInfo    propInfo    = propManager.m_props.m_buffer[prop].Info;
            Vector3     position    = propManager.m_props.m_buffer[prop].Position;
            float       angle       = propManager.m_props.m_buffer[prop].Angle;
            Randomizer  randomizer  = new Randomizer((int)prop);
            float       scale       = propInfo.m_minScale + (float)randomizer.Int32(10000u) * (propInfo.m_maxScale - propInfo.m_minScale) * 0.0001f;
            float       alpha       = 1f;

            PropTool.CheckOverlayAlpha(propInfo, scale, ref alpha);
            toolColor.a *= alpha;
            PropTool.RenderOverlay(cameraInfo, propInfo, position, scale, angle, toolColor);
        }
コード例 #33
0
    public void setGoodsId(int goods_id)
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("MedalDuiHuanQueRenPanelScript_hotfix", "setGoodsId"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.MedalDuiHuanQueRenPanelScript_hotfix", "setGoodsId", null, goods_id);
            return;
        }

        m_medalDuiHuanRewardData = MedalDuiHuanRewardData.getInstance().getMedalDuiHuanRewardDataContentById(goods_id);

        if (m_medalDuiHuanRewardData != null)
        {
            m_text_goods_name.text = m_medalDuiHuanRewardData.name;

            m_text_goods_num.text = m_goods_num.ToString();

            List <string> list_str = new List <string>();
            CommonUtil.splitStr(m_medalDuiHuanRewardData.reward_prop, list_str, ':');
            int prop_id = int.Parse(list_str[0]);

            // 道具图标
            {
                CommonUtil.setImageSprite(m_text_goods_icon, GameUtil.getPropIconPath(prop_id));
            }

            // 道具描述
            {
                if ((prop_id != 1) && (prop_id != 2))
                {
                    PropInfo propInfo = PropData.getInstance().getPropInfoById(prop_id);
                    if (propInfo != null)
                    {
                        m_text_goods_desc.text = propInfo.m_desc;
                    }
                }
            }

            refreshPrice();
        }
    }
コード例 #34
0
        public static void ReplaceProps(this NetInfo info, PropInfo newPropInfo, PropInfo oldPropInfo)
        {
            if (newPropInfo == null || oldPropInfo == null)
            {
                return;
            }

            foreach (var lane in info.m_lanes.Where(l => l.m_laneProps != null))
            {
                if (lane.m_laneProps.m_props == null ||
                    lane.m_laneProps.m_props.Length == 0)
                {
                    continue;
                }

                var oldProp = lane
                    .m_laneProps
                    .m_props
                    .FirstOrDefault(prop => prop.m_prop == oldPropInfo);

                if (oldProp != null)
                {
                    var newSpeedLimitProp = oldProp.ShallowClone();
                    newSpeedLimitProp.m_prop = newPropInfo;
                    newSpeedLimitProp.m_finalProp = null;

                    var newPropsContent = new List<NetLaneProps.Prop>();
                    newPropsContent.AddRange(lane.m_laneProps.m_props.Where(prop => prop.m_prop != oldPropInfo));
                    newPropsContent.Add(newSpeedLimitProp);

                    var newProps = ScriptableObject.CreateInstance<NetLaneProps>();
                    newProps.name = lane.m_laneProps.name;
                    newProps.m_props = newPropsContent.ToArray();
                    lane.m_laneProps = newProps;
                }
            }
        }
コード例 #35
0
 private static void Replace(PropInfo prop, Flag modification)
 {
     var material = prop.GetComponent<Renderer>().sharedMaterial;
     material.mainTexture = modification.texture;
     var lodMaterial = prop.m_lodObject.GetComponent<Renderer>().sharedMaterial;
     lodMaterial.mainTexture = modification.textureLod;
 }
コード例 #36
0
 public void OnPrePropInit(PropInfo prop)
 {
     if (prop == null)
     {
         return;
     }
     if (prop.name != "flag_pole_wall" && prop.name != "flag_pole")
     {
         return;
     }
     if (OptionsHolder.Options.replacement != string.Empty)
     {
         foreach (var flag in Flags.Where(flag => (flag.plugin == null || flag.plugin.isEnabled) && flag.id == OptionsHolder.Options.replacement))
         {
             Replace(prop, flag);
             break;
         }
     }
     var isWall = "flag_pole_wall".Equals(prop.name);
     LoadingManager.instance.QueueLoadingAction(Util.ActionWrapper(() =>
     {
         var counter = prop.m_UIPriority;
         foreach (var prefab in Flags
         .Where(flag => flag.plugin == null || flag.plugin.isEnabled)
         .Select(flag => Clone(prop, flag, isWall)))
         {
             prefab.m_UIPriority = ++counter;
         }
     }));
 }
 private static PropInfo ProcessDataCore(UnsafeNativeMethods.ITypeInfo typeInfo, IDictionary propInfoList, int dispid, int nameDispID, System.Windows.Forms.NativeMethods.tagTYPEDESC typeDesc, int flags, StructCache structCache)
 {
     string pBstrName = null;
     string pBstrDocString = null;
     int hr = typeInfo.GetDocumentation(dispid, ref pBstrName, ref pBstrDocString, null, null);
     ComNativeDescriptor instance = ComNativeDescriptor.Instance;
     if (!System.Windows.Forms.NativeMethods.Succeeded(hr))
     {
         throw new COMException(System.Windows.Forms.SR.GetString("TYPEINFOPROCESSORGetDocumentationFailed", new object[] { dispid, hr, instance.GetClassName(typeInfo) }), hr);
     }
     if (pBstrName == null)
     {
         return null;
     }
     PropInfo info = (PropInfo) propInfoList[pBstrName];
     if (info == null)
     {
         info = new PropInfo {
             Index = propInfoList.Count
         };
         propInfoList[pBstrName] = info;
         info.Name = pBstrName;
         info.DispId = dispid;
         info.Attributes.Add(new DispIdAttribute(info.DispId));
     }
     if (pBstrDocString != null)
     {
         info.Attributes.Add(new DescriptionAttribute(pBstrDocString));
     }
     if (info.ValueType == null)
     {
         object[] typeData = new object[1];
         try
         {
             info.ValueType = GetValueTypeFromTypeDesc(typeDesc, typeInfo, typeData, structCache);
         }
         catch (Exception)
         {
         }
         if (info.ValueType == null)
         {
             info.NonBrowsable = true;
         }
         if (info.NonBrowsable)
         {
             flags |= 0x400;
         }
         if (typeData[0] != null)
         {
             info.TypeData = typeData[0];
         }
     }
     if ((flags & 1) != 0)
     {
         info.ReadOnly = 1;
     }
     if ((((flags & 0x40) != 0) || ((flags & 0x400) != 0)) || ((info.Name[0] == '_') || (dispid == -515)))
     {
         info.Attributes.Add(new BrowsableAttribute(false));
         info.NonBrowsable = true;
     }
     if ((flags & 0x200) != 0)
     {
         info.IsDefault = true;
     }
     if (((flags & 4) != 0) && ((flags & 0x10) != 0))
     {
         info.Attributes.Add(new BindableAttribute(true));
     }
     if (dispid == nameDispID)
     {
         info.Attributes.Add(new ParenthesizePropertyNameAttribute(true));
         info.Attributes.Add(new MergablePropertyAttribute(false));
     }
     return info;
 }
コード例 #38
0
        private Curve CreateCurve(PropInfo prop)
        {
            try
            {
                Ease ease = (prop.ease == null) ? _defaultEase : prop.ease;
                float dur = prop.dur;
                switch (prop.mode)
                {
                    case AnimMode.Curve:
                        return prop.value as Curve;
                    case AnimMode.To:
                        return MemberCurve.CreateTo(_targ, prop.name, ease, prop.value, dur, prop.option);
                    case AnimMode.From:
                        return MemberCurve.CreateFrom(_targ, prop.name, ease, prop.value, dur, prop.option);
                    case AnimMode.By:
                        return MemberCurve.CreateBy(_targ, prop.name, ease, prop.value, dur, prop.option);
                    case AnimMode.FromTo:
                        return MemberCurve.CreateFromTo(_targ, prop.name, ease, prop.value, prop.altValue, dur, prop.option);
                    case AnimMode.RedirectTo:
                        return MemberCurve.CreateRedirectTo(_targ, prop.name, ease, ConvertUtil.ToSingle(prop.value), ConvertUtil.ToSingle(prop.altValue), dur, prop.option);
                }
            }
            catch
            {
                return null;
            }

            return null;
        }
コード例 #39
0
        private static PropInfo Clone(PropInfo prop, Flag modification, bool isWall)
        {
            var gameObject = GameObject.Find("MoreFlags") ?? new GameObject("MoreFlags");
            var collection = gameObject.GetComponent<FlagsCollection>() ?? gameObject.AddComponent<FlagsCollection>();
            var instance = Object.Instantiate(prop.gameObject);
            var clone = instance.GetComponent<PropInfo>();
            var name = $"{prop.name}_{modification.id}";
            clone.name = name;
            instance.name = name;
            instance.transform.parent = gameObject.transform;
            clone.GetComponent<Renderer>().material.mainTexture = modification.texture;
            clone.GetComponent<Renderer>().material.name = $"{prop.GetComponent<Renderer>().material.name}_{modification.id}";
//            clone.m_lodObject = Object.Instantiate(prop.m_lodObject);
//            clone.m_lodObject.transform.parent = instance.transform;
//            clone.m_lodObject.name = prop.m_lodObject.name + $"_{modification.id}";
//            var renderer = clone.m_lodObject.GetComponent<MeshRenderer>();
//            Object.DestroyImmediate(renderer);
//            renderer = clone.m_lodObject.AddComponent<MeshRenderer>();
//            renderer.material= new Material(prop.m_lodObject.GetComponent<Renderer>().sharedMaterial)
//            {
//                mainTexture = modification.textureLod,
//                name = $"{prop.m_lodObject.GetComponent<Renderer>().sharedMaterial.name}_{modification.id}"
//            };
            clone.m_placementStyle = ItemClass.Placement.Manual;
            clone.m_createRuining = false;
            clone.m_Atlas = _atlas;
            clone.m_InfoTooltipAtlas = _atlas;
            var thumb = isWall ? modification.thumbWall : modification.thumb;
            if (thumb != null)
            {
                clone.m_Thumbnail = thumb.name;
                clone.m_InfoTooltipThumbnail = thumb.name;
            }
            PrefabCollection<PropInfo>.InitializePrefabs("MoreFlags", new[] { clone }, null);
            ApplyRenderDistanceHack(clone);
            AddLocale(modification, isWall, name);
            collection.flags.Add(clone);
            return clone;
        }
コード例 #40
0
ファイル: PSMSupport.cs プロジェクト: zeest/VitaDefiler
        internal PropInfo[] Type_GetProperties(long id)
        {
            PacketReader r = SendReceive(CommandSet.TYPE, (int)CmdType.GET_PROPERTIES, new PacketWriter().WriteId(id));

            int n = r.ReadInt();
            PropInfo[] res = new PropInfo[n];
            for (int i = 0; i < n; ++i)
            {
                res[i] = new PropInfo();
                res[i].id = r.ReadId();
                res[i].name = r.ReadString();
                res[i].get_method = r.ReadId();
                res[i].set_method = r.ReadId();
                res[i].attrs = r.ReadInt();
            }

            return res;
        }
コード例 #41
0
        public void SetStreetLight(NetInfo prefab, PropInfo prop)
        {
            var newSegmentData = new SegmentData(SegmentDataManager.Instance.GetActiveOptions(prefab));

            if (prop != GetDefaultStreetLight(prefab))
            {
                newSegmentData.SetPrefabFeature(SegmentData.FeatureFlags.StreetLight, prop);
            }
            else
            {
                newSegmentData.UnsetFeature(SegmentData.FeatureFlags.StreetLight);
            }

            SegmentDataManager.Instance.SetActiveOptions(prefab, newSegmentData);
        }
コード例 #42
0
 //hack to always render main model instad of LOD. Should be after initializing
 private static void ApplyRenderDistanceHack(PropInfo flag)
 {
     flag.m_maxRenderDistance = 590; 
     flag.m_lodRenderDistance = 590;
 }
コード例 #43
0
 private static PropInfo Clone(PropInfo prop, Flag modification, bool isWall)
 {
     var gameObject = GameObject.Find("MoreFlags") ?? new GameObject("MoreFlags");
     var clone = Util.ClonePrefab(prop, prop.name + $"_{modification.id}", gameObject.transform);
     PrefabCollection<PropInfo>.InitializePrefabs("MoreFlags", new[] { clone }, null);
     clone.m_material = Object.Instantiate(prop.m_material);
     clone.m_material.name = prop.m_material.name + $"_{modification.id}";
     clone.m_material.mainTexture = modification.texture;
     clone.m_lodMaterial = Object.Instantiate(prop.m_lodMaterial);
     clone.m_lodMaterial.name = prop.m_lodMaterial.name + $"_{modification.id}";
     clone.m_lodMaterial.mainTexture = modification.textureLod;
     clone.m_placementStyle = ItemClass.Placement.Manual;
     clone.m_createRuining = false;
     clone.m_Atlas = _atlas;
     clone.m_InfoTooltipAtlas = _atlas;
     var thumb = isWall ? modification.thumbWall : modification.thumb;
     if (thumb != null)
     {
         clone.m_Thumbnail = thumb.name;
         clone.m_InfoTooltipThumbnail = thumb.name;
     }
     var locale = (Locale)LocaleField.GetValue(SingletonLite<LocaleManager>.instance);
     var key = new Locale.Key { m_Identifier = "PROPS_TITLE", m_Key = clone.name };
     var versionStr = isWall ? "wall" : "ground";
     var extendedDescription =
         modification.extendedDescripton == string.Empty ? modification.description : modification.extendedDescripton;
     if (!locale.Exists(key))
     {
         locale.AddLocalizedString(key, $"{modification.description} ({versionStr} version)");
     }
     key = new Locale.Key { m_Identifier = "PROPS_DESC", m_Key = clone.name };
     if (!locale.Exists(key))
     {
         locale.AddLocalizedString(key, $"{extendedDescription} ({versionStr} version)");
     }
     return clone;
 }
コード例 #44
0
 private bool IsPlacementRelevant(PropInfo info)
 {
     throw new NotImplementedException("IsPlacementRelevant is target of redirection and is not implemented.");
 }
コード例 #45
0
 /// <summary>
 /// Deserialize next object from a FastTransferStream.
 /// </summary>
 /// <param name="stream">A FastTransferStream.</param>
 public override void ConsumeNext(FastTransferStream stream)
 {
     base.ConsumeNext(stream);
     this.propType = stream.ReadUInt16();
     PropInfo = PropInfo.DeserializeFrom(stream) as PropInfo;
 }
コード例 #46
0
        private static void AddBollards(this NetInfo info, NetInfoVersion version, PropInfo bollardInfo = null, BuildingInfo pillarInfo = null)
        {
            if (version == NetInfoVersion.Bridge || version == NetInfoVersion.Elevated)
            {
                if (pillarInfo == null)
                {
                    pillarInfo = Prefabs.Find<BuildingInfo>("Pedestrian Elevated Pillar", false);
                }

                var bridgeAI = info.GetComponent<RoadBridgeAI>();
                if (pillarInfo != null && bridgeAI != null)
                {
                    bridgeAI.m_doubleLength = false;
                    bridgeAI.m_bridgePillarInfo = pillarInfo;
                    bridgeAI.m_middlePillarInfo = null;
                    bridgeAI.m_bridgePillarOffset = 0;
                }
            }

            if (bollardInfo != null)
            {
                var bollardProp1 = new NetLaneProps.Prop()
                {
                    m_prop = bollardInfo,
                    m_finalProp = bollardInfo,
                    m_probability = 100,
                    m_segmentOffset = 1,
                    m_minLength = 10,
                    m_endFlagsRequired = NetNode.Flags.Transition
                };
                bollardProp1.m_position.x = -3.5f;
                bollardProp1.m_position.y = -0.3f;

                var bollardProp2 = bollardProp1.ShallowClone();
                bollardProp2.m_segmentOffset = -1;
                bollardProp2.m_endFlagsRequired = NetNode.Flags.None;
                bollardProp2.m_startFlagsRequired = NetNode.Flags.Transition;

                var bollardProp3 = bollardProp1.ShallowClone();
                bollardProp3.m_position.x = 3.5f;

                var bollardProp4 = bollardProp2.ShallowClone();
                bollardProp4.m_position.x = 3.5f;

                var bollardProp5 = bollardProp1.ShallowClone();
                bollardProp5.m_position.x = 0;

                var bollardProp6 = bollardProp2.ShallowClone();
                bollardProp6.m_position.x = 0;

                var propPedLane = info
                    .m_lanes
                    .First(l => l.m_position == 0f && l.m_laneType == NetInfo.LaneType.Pedestrian);

                propPedLane.m_laneProps.m_props =  propPedLane
                    .m_laneProps
                    .m_props
                    .Union(new[] { bollardProp1, bollardProp2, bollardProp3, bollardProp4, bollardProp5, bollardProp6})
                    .ToArray();
            }
        }
コード例 #47
0
ファイル: Util.cs プロジェクト: aoighost/Skylines-MoreFlags
 public static PropInfo ClonePrefab(PropInfo originalPrefab, string newName, Transform parentTransform)
 {
     var instance = Object.Instantiate(originalPrefab);
     instance.name = newName;
     instance.transform.SetParent(parentTransform);
     instance.transform.localPosition = new Vector3(-7500, -7500, -7500);
     instance.m_generatedInfo = Object.Instantiate(originalPrefab.m_generatedInfo);
     instance.m_generatedInfo.name = newName + " (GeneratedInfo)";
     instance.m_generatedInfo.m_propInfo = null;
     instance.gameObject.SetActive(false);
     return instance;
 }
コード例 #48
0
 public void OnPostPropInit(PropInfo prop)
 {
     if (OptionsHolder.Options.replacement == string.Empty)
     {
         return;
     }
     if (prop == null)
     {
         return;
     }
     if (prop.name != "flag_pole_wall" && prop.name != "flag_pole")
     {
         return;
     }
     ApplyRenderDistanceHack(prop);
 }