public override void ConstructPlayer()
        {
            this.debugWriter.WriteLine("Constructing Local Player");

            this.player = PlayerController.Instance.skaterController.skaterTransform.gameObject;
            this.debugWriter.WriteLine("Found player");

            this.debugWriter.WriteLine("All clothing ID's");
            foreach (KeyValuePair <string, CharacterGearTemplate> pair in GearDatabase.Instance.CharGearTemplateForID)
            {
                this.debugWriter.WriteLine(pair.Key);
            }

            /* Get the body textures */
            if (currentBody.gearInfo.materialChanges != null && currentBody.gearInfo.materialChanges.Count > 0)
            {
                string pathHead = "";
                string pathBody = "";
                bool   isCustom = currentBody.gearInfo.isCustom;

                this.debugWriter.WriteLine("Body changes\n{0}", currentBody.gearInfo.type);
                if (currentBody.gearInfo.tags != null)
                {
                    this.debugWriter.WriteLine("Tags length {0}", currentBody.gearInfo.tags.Length);
                }

                foreach (MaterialChange matChange in currentBody.gearInfo.materialChanges)
                {
                    this.debugWriter.WriteLine("Mat ID: {0}", matChange.materialID);
                    foreach (TextureChange change in matChange.textureChanges)
                    {
                        this.debugWriter.WriteLine("tex ID: {0}", change.textureID);
                        if (change.textureID.ToLower().Equals("albedo"))
                        {
                            if (matChange.materialID.ToLower().Equals("head"))
                            {
                                pathHead = change.texturePath;
                            }
                            else
                            {
                                pathBody = change.texturePath;
                            }
                        }
                    }
                }

                multiplayerTextures.Add(new MultiplayerLocalTexture(isCustom, pathHead, "head", GearInfoType.Body, this.debugWriter));
                multiplayerTextures.Add(new MultiplayerLocalTexture(isCustom, pathBody, "body", GearInfoType.Body, this.debugWriter));
            }

            foreach (ClothingGearObjet clothingPiece in gearList)
            {
                // Get the path of the gear piece
                string path   = "";
                bool   custom = clothingPiece.gearInfo.isCustom;
                foreach (TextureChange change in clothingPiece.gearInfo.textureChanges)
                {
                    if (change.textureID.ToLower().Equals("albedo"))
                    {
                        path = change.texturePath;
                    }
                }

                multiplayerTextures.Add(new MultiplayerLocalTexture(custom, path, clothingPiece.gearInfo.type, GearInfoType.Clothing, this.debugWriter));
            }

            foreach (BoardGearObject boardGear in boardGearList)
            {
                // Get the path of the gear piece
                string path   = "";
                bool   custom = boardGear.gearInfo.isCustom;
                foreach (TextureChange change in boardGear.gearInfo.textureChanges)
                {
                    if (change.textureID.ToLower().Equals("albedo"))
                    {
                        path = change.texturePath;
                    }
                }

                string gearType = BoardGearObject.AdaptMaterialID(boardGear.gearInfo.type);


                multiplayerTextures.Add(new MultiplayerLocalTexture(custom, path, boardGear.gearInfo.type, GearInfoType.Board, this.debugWriter));
            }

            for (int i = 0; i < MultiplayerUtils.audioPlayerNames.Count; i++)
            {
                if (lastSentOneShots.Count < i + 1)
                {
                    lastSentOneShots.Add(null);
                }
                if (lastSentClipEvents.Count < i + 1)
                {
                    lastSentClipEvents.Add(null);
                }
                if (lastSentVolumeEvents.Count < i + 1)
                {
                    lastSentVolumeEvents.Add(null);
                }
                if (lastSentPitchEvents.Count < i + 1)
                {
                    lastSentPitchEvents.Add(null);
                }
                if (lastSentCutoffEvents.Count < i + 1)
                {
                    lastSentCutoffEvents.Add(null);
                }

                lastSentOneShots[i]     = ReplayRecorder.Instance.oneShotEvents != null && ReplayRecorder.Instance.oneShotEvents.ContainsKey(MultiplayerUtils.audioPlayerNames[i]) && ReplayRecorder.Instance.oneShotEvents[MultiplayerUtils.audioPlayerNames[i]].Count > 0 ? ReplayRecorder.Instance.oneShotEvents[MultiplayerUtils.audioPlayerNames[i]][ReplayRecorder.Instance.oneShotEvents[MultiplayerUtils.audioPlayerNames[i]].Count - 1] : null;
                lastSentClipEvents[i]   = ReplayRecorder.Instance.clipEvents != null && ReplayRecorder.Instance.clipEvents.ContainsKey(MultiplayerUtils.audioPlayerNames[i]) && ReplayRecorder.Instance.clipEvents[MultiplayerUtils.audioPlayerNames[i]].Count > 0 ? ReplayRecorder.Instance.clipEvents[MultiplayerUtils.audioPlayerNames[i]][ReplayRecorder.Instance.clipEvents[MultiplayerUtils.audioPlayerNames[i]].Count - 1] : null;
                lastSentVolumeEvents[i] = ReplayRecorder.Instance.volumeEvents != null && ReplayRecorder.Instance.volumeEvents.ContainsKey(MultiplayerUtils.audioPlayerNames[i]) && ReplayRecorder.Instance.volumeEvents[MultiplayerUtils.audioPlayerNames[i]].Count > 0 ? ReplayRecorder.Instance.volumeEvents[MultiplayerUtils.audioPlayerNames[i]][ReplayRecorder.Instance.volumeEvents[MultiplayerUtils.audioPlayerNames[i]].Count - 1] : null;
                lastSentPitchEvents[i]  = ReplayRecorder.Instance.pitchEvents != null && ReplayRecorder.Instance.pitchEvents.ContainsKey(MultiplayerUtils.audioPlayerNames[i]) && ReplayRecorder.Instance.pitchEvents[MultiplayerUtils.audioPlayerNames[i]].Count > 0 ? ReplayRecorder.Instance.pitchEvents[MultiplayerUtils.audioPlayerNames[i]][ReplayRecorder.Instance.pitchEvents[MultiplayerUtils.audioPlayerNames[i]].Count - 1] : null;
                lastSentCutoffEvents[i] = ReplayRecorder.Instance.cutoffEvents != null && ReplayRecorder.Instance.cutoffEvents.ContainsKey(MultiplayerUtils.audioPlayerNames[i]) && ReplayRecorder.Instance.cutoffEvents[MultiplayerUtils.audioPlayerNames[i]].Count > 0 ? ReplayRecorder.Instance.cutoffEvents[MultiplayerUtils.audioPlayerNames[i]][ReplayRecorder.Instance.cutoffEvents[MultiplayerUtils.audioPlayerNames[i]].Count - 1] : null;
            }

            this.debugWriter.WriteLine("Finished constructing local player");

            foreach (Transform bone in ReplayRecorder.Instance.RecordedTransforms.ToArray())
            {
                Transform parent = bone.parent;
                while (parent != null)
                {
                    this.debugWriter.Write("\t");
                    parent = parent.parent;
                }
                this.debugWriter.Write("-> " + bone.name + "\n");
            }
        }
Пример #2
0
        public override void ConstructPlayer()
        {
            this.debugWriter.WriteLine("Constructing Local Player");

            this.player = PlayerController.Instance.skaterController.skaterTransform.gameObject;
            this.debugWriter.WriteLine("Found player");

            this.debugWriter.WriteLine("All clothing ID's");
            foreach (KeyValuePair <string, CharacterGearTemplate> pair in GearDatabase.Instance.CharGearTemplateForID)
            {
                this.debugWriter.WriteLine(pair.Key);
            }

            shirtMPTex = new MultiplayerLocalTexture(MPTextureType.Shirt, this.debugWriter);
            pantsMPTex = new MultiplayerLocalTexture(MPTextureType.Pants, this.debugWriter);
            shoesMPTex = new MultiplayerLocalTexture(MPTextureType.Shoes, this.debugWriter);
            hatMPTex   = new MultiplayerLocalTexture(MPTextureType.Hat, this.debugWriter);
            deckMPTex  = new MultiplayerLocalTexture(MPTextureType.Deck, this.debugWriter);
            gripMPTex  = new MultiplayerLocalTexture(MPTextureType.Grip, this.debugWriter);
            wheelMPTex = new MultiplayerLocalTexture(MPTextureType.Wheels, this.debugWriter);
            truckMPTex = new MultiplayerLocalTexture(MPTextureType.Trucks, this.debugWriter);
            headMPTex  = new MultiplayerLocalTexture(MPTextureType.Head, this.debugWriter);
            bodyMPTex  = new MultiplayerLocalTexture(MPTextureType.Body, this.debugWriter);

            foreach (ClothingGearObjet clothingPiece in gearList)
            {
                // Get the path of the gear piece
                string path   = "";
                bool   custom = clothingPiece.gearInfo.isCustom;
                foreach (TextureChange change in clothingPiece.gearInfo.textureChanges)
                {
                    if (change.textureID.ToLower().Equals("albedo"))
                    {
                        path = change.texturePath;
                    }
                }

                switch (clothingPiece.template.categoryName.ToLower())
                {
                case "shirt":
                    this.shirtMPTex = new MultiplayerLocalTexture(custom, path, MPTextureType.Shirt, this.debugWriter)
                    {
                        useFull = false
                    };
                    break;

                case "hoodie":
                    this.shirtMPTex = new MultiplayerLocalTexture(custom, path, MPTextureType.Shirt, this.debugWriter)
                    {
                        useFull = true
                    };
                    break;

                case "hat":
                    this.hatMPTex = new MultiplayerLocalTexture(custom, path, MPTextureType.Hat, this.debugWriter);
                    break;

                case "pants":
                    this.pantsMPTex = new MultiplayerLocalTexture(custom, path, MPTextureType.Pants, this.debugWriter);
                    break;

                case "shoes":
                    this.shoesMPTex = new MultiplayerLocalTexture(custom, path, MPTextureType.Shoes, this.debugWriter);
                    break;
                }
            }

            foreach (BoardGearObject boardGear in boardGearList)
            {
                // Get the path of the gear piece
                string path   = "";
                bool   custom = boardGear.gearInfo.isCustom;
                foreach (TextureChange change in boardGear.gearInfo.textureChanges)
                {
                    if (change.textureID.ToLower().Equals("albedo"))
                    {
                        path = change.texturePath;
                    }
                }

                string gearType = BoardGearObject.AdaptMaterialID(boardGear.gearInfo.type);

                switch (gearType)
                {
                case "deck":
                    this.deckMPTex = new MultiplayerLocalTexture(custom, path, MPTextureType.Deck, this.debugWriter);
                    break;

                case "griptape":
                    this.gripMPTex = new MultiplayerLocalTexture(custom, path, MPTextureType.Grip, this.debugWriter);
                    break;

                case "truck":
                    this.truckMPTex = new MultiplayerLocalTexture(custom, path, MPTextureType.Trucks, this.debugWriter);
                    break;

                case "wheel":
                    this.wheelMPTex = new MultiplayerLocalTexture(custom, path, MPTextureType.Wheels, this.debugWriter);
                    break;
                }
            }

            /* Get the body textures */
            {
                string pathHead = "";
                string pathBody = "";
                bool   isCustom = currentBody.gearInfo.isCustom;

                this.debugWriter.WriteLine("Body changes\n{0}", currentBody.gearInfo.type);
                if (currentBody.gearInfo.tags != null)
                {
                    this.debugWriter.WriteLine("Tags length {0}", currentBody.gearInfo.tags.Length);
                }

                foreach (MaterialChange matChange in currentBody.gearInfo.materialChanges)
                {
                    this.debugWriter.WriteLine("Mat ID: {0}", matChange.materialID);
                    foreach (TextureChange change in matChange.textureChanges)
                    {
                        this.debugWriter.WriteLine("tex ID: {0}", change.textureID);
                        if (change.textureID.ToLower().Equals("albedo"))
                        {
                            if (matChange.materialID.ToLower().Equals("head"))
                            {
                                pathHead = change.texturePath;
                            }
                            else
                            {
                                pathBody = change.texturePath;
                            }
                        }
                    }
                }

                this.headMPTex = new MultiplayerLocalTexture(isCustom, pathHead, MPTextureType.Head, this.debugWriter);
                this.bodyMPTex = new MultiplayerLocalTexture(isCustom, pathBody, MPTextureType.Body, this.debugWriter);
            }

            this.debugWriter.WriteLine("Finished constructing local player");
        }