示例#1
0
        public void parseBytes(byte[] arr, bool withType)
        {
            byte[] rawbytes = arr;
            if (withType)
            {
                this.type = this.configTypeFromBytes(arr);
                rawbytes  = this.byteWithoutTypeByteFlag(arr);
            }

            if (this.type != ConfigType.None)
            {
                if (this.type == ConfigType.Fishing)
                {
                    this.fishingConfig = this.fishingConfigFromBytes(rawbytes);
                }
                else if (this.type == ConfigType.Combat)
                {
                    this.combatConfig = this.combatConfigFromBytes(rawbytes);
                }
                else if (this.type == ConfigType.Gathering)
                {
                    this.gatheringConfig = this.gatheringConfigFromBytes(rawbytes);
                }
            }
        }
示例#2
0
        public GatheringConfig gatheringConfigFromBytes(byte[] arr)
        {
            GatheringConfig str = new GatheringConfig();

            int    size = Marshal.SizeOf(str);
            IntPtr ptr  = Marshal.AllocHGlobal(size);

            Marshal.Copy(arr, 0, ptr, size);

            str = (GatheringConfig)Marshal.PtrToStructure(ptr, str.GetType());
            Marshal.FreeHGlobal(ptr);

            return(str);
        }
示例#3
0
        public static GatheringConfig defaultGatheringConfig()
        {
            GatheringConfig defaultGathering = new GatheringConfig();

            defaultGathering.matureTree          = 0;
            defaultGathering.lushVegetationPatch = 0;
            defaultGathering.mineralDeposit      = 0;
            defaultGathering.rockyOutcrop        = 0;

            GeneralKeys defaultGeneral = new GeneralKeys();

            defaultGeneral.forward     = UseableKeys.W;
            defaultGeneral.backward    = UseableKeys.S;
            defaultGeneral.rotateLeft  = UseableKeys.A;
            defaultGeneral.rotateRight = UseableKeys.D;
            defaultGeneral.action      = UseableKeys.Num0;
            defaultGathering.movement  = defaultGeneral;

            return(defaultGathering);
        }