コード例 #1
0
ファイル: LoadDebugInfo.cs プロジェクト: superowner/FBXLoader
 // M I N I M A L   I N F O
 public void MinimalInfo(SkinModel model, string filePath)
 {
     Console.WriteLine("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
     Console.WriteLine("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); Console.WriteLine();
     Console.WriteLine($"Model");
     Console.WriteLine($"{ld.GetFileName(filePath, true)}  Loaded"); Console.WriteLine();
     Console.WriteLine("Model sceneRootNodeOfTree's Node Name:     " + model.rootNodeOfTree.name);
     Console.WriteLine("Model number of animaton: " + model.animations.Count);
     Console.WriteLine("Model number of meshes:   " + model.meshes.Length);
     for (int mmLoop = 0; mmLoop < model.meshes.Length; mmLoop++)
     {
         var rmMesh = model.meshes[mmLoop];
         Console.WriteLine("Model mesh #" + mmLoop + " of  " + model.meshes.Length + "   Name: " + rmMesh.Name + "   MaterialIndex: " + rmMesh.material_index + "  MaterialIndexName: " + rmMesh.material_name + "  Bones.Count " + model.meshes[mmLoop].meshBones.Count() + " ([0] is a generated bone to the mesh)");
         if (rmMesh.tex_diffuse != null)
         {
             Console.WriteLine("texture: " + rmMesh.tex_name);
         }
         if (rmMesh.tex_normalMap != null)
         {
             Console.WriteLine("textureNormalMap: " + rmMesh.tex_normMap_name);
         }
         /// May add more texture types later in which case we may want to update this for debugging if needed
         //if (rmMesh.textureHeightMap != null) Console.WriteLine("textureHeightMap: " + rmMesh.textureHeightMapName);
     }
     Console.WriteLine(); Console.WriteLine("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
     Console.WriteLine("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); Console.WriteLine("\n");
 }
コード例 #2
0
ファイル: PageSkin.xaml.cs プロジェクト: FateNineMeow/LuMei
        private void SelectSkin(object sender, SelectionChangedEventArgs e)
        {
            if (SkinList.SelectedIndex < 0)
            {
                SkinOperation.Visibility = Visibility.Hidden;
                SkinComment.Visibility   = Visibility.Hidden;
                return;
            }
            var skin = (Skin)SkinList.SelectedItem;

            _soft.SetBackImage(skin);
            var skinmodel = new SkinModel
            {
                Id       = skin.Id,
                SkinName = skin.SkinName,
                HeroName = _lumei.EnNameToChName(skin.Hero),
                Author   = !string.IsNullOrWhiteSpace(skin.Author) ? skin.Author : "未知",
                Comment  = !string.IsNullOrWhiteSpace(skin.Comment) ? skin.Comment : "暂无简介!"
            };

            SkinOperation.Visibility = Visibility.Visible;
            SkinComment.Visibility   = Visibility.Visible;
            if (skin.MountType == "已挂载")
            {
                BtnSkinMount.Visibility   = Visibility.Hidden;
                BtnSkinUnMount.Visibility = Visibility.Visible;
            }
            else
            {
                BtnSkinMount.Visibility   = Visibility.Visible;
                BtnSkinUnMount.Visibility = Visibility.Hidden;
            }
            SkinComment.Dispatcher.BeginInvoke(new Action(() => { SkinComment.DataContext = skinmodel; }), null);
            SkinOperation.Visibility = Visibility.Visible;
        }
コード例 #3
0
ファイル: Login.cs プロジェクト: timnboys/WiredPlayers-RP
        public void CreateCharacterEvent(Client player, params object[] arguments)
        {
            // Recuperamos el nombre y edad
            String playerName = arguments[0].ToString();
            int    playerAge  = Int32.Parse(arguments[1].ToString());

            PlayerModel playerModel = new PlayerModel();
            SkinModel   skinModel   = JsonConvert.DeserializeObject <SkinModel>(arguments[2].ToString());

            // Generación del modelo del personaje
            playerModel.realName = playerName;
            playerModel.age      = playerAge;
            playerModel.sex      = NAPI.Data.GetEntitySharedData(player, EntityData.PLAYER_SEX);

            // Generación del modelo del personaje
            PopulateCharacterSkin(player, skinModel);

            int playerId = Database.CreateCharacter(player, playerModel, skinModel);

            if (playerId > 0)
            {
                InitializePlayerData(player);
                NAPI.Data.SetEntityData(player, EntityData.PLAYER_SQL_ID, playerId);
                NAPI.Data.SetEntityData(player, EntityData.PLAYER_NAME, playerName);
                NAPI.Data.SetEntitySharedData(player, EntityData.PLAYER_AGE, playerAge);
                NAPI.Data.SetEntitySharedData(player, EntityData.PLAYER_SPAWN_POS, new Vector3(200.6641f, -932.0939f, 30.6868f));
                NAPI.Data.SetEntitySharedData(player, EntityData.PLAYER_SPAWN_ROT, new Vector3(0.0f, 0.0f, 0.0f));
                Database.UpdateLastCharacter(player.SocialClubName, playerId);
                NAPI.ClientEvent.TriggerClientEvent(player, "characterCreatedSuccessfully");
            }
        }
コード例 #4
0
        public JsonResult Editar(int id, SkinModel vm)
        {
            try
            {
                using (var db = new SkinsContext())
                {
                    var item = db.Skins.FirstOrDefault(x => x.Id == id);

                    if (item != null)
                    {
                        item.AtulizarDominio(vm);

                        db.SaveChanges();
                    }
                    else
                    {
                        return(Json(new { Sucesso = false }));
                    }
                }

                return(Json(new { Sucesso = true }));
            }
            catch (Exception)
            {
                return(Json(new { Sucesso = false }));
            }
        }
コード例 #5
0
        public static void Invoke(SkinModel skin)
        {
            var e = new SkinChangedArgs(skin.Background, skin.IsImageBrush);

            File.WriteAllLines(JmSkinChangedUtil.SkinConfigFilePath, new[] { skin.IsImageBrush.ToString(), skin.ImagePathOrColor });
            SkinChangedEvent(null, e);
        }
コード例 #6
0
ファイル: Login.cs プロジェクト: timnboys/WiredPlayers-RP
        public void LoadCharacterEvent(Client player, params object[] arguments)
        {
            PlayerModel playerModel = Database.LoadCharacterInformationByName(arguments[0].ToString());
            SkinModel   skinModel   = Database.GetCharacterSkin(playerModel.id);

            // Carga de skin hombre/mujer
            String  pedModel = playerModel.sex == 0 ? Constants.MALE_PED_MODEL : Constants.FEMALE_PED_MODEL;
            PedHash pedHash  = NAPI.Util.PedNameToModel(pedModel);

            NAPI.Player.SetPlayerName(player, playerModel.realName);
            NAPI.Player.SetPlayerSkin(player, pedHash);

            // Cargamos los datos básicos del personaje
            LoadCharacterData(player, playerModel);

            // Generación del modelo del personaje
            PopulateCharacterSkin(player, skinModel);

            // Generación de la ropa del personaje
            Globals.PopulateCharacterClothes(player);

            // Añadimos la vida y chaleco
            NAPI.Player.SetPlayerHealth(player, playerModel.health);
            NAPI.Player.SetPlayerArmor(player, playerModel.armor);

            Database.UpdateLastCharacter(player.SocialClubName, playerModel.id);
        }
コード例 #7
0
        public void CreateCharacterEvent(Client player, String playerName, int playerAge, String skinJson)
        {
            PlayerModel playerModel = new PlayerModel();
            SkinModel   skinModel   = JsonConvert.DeserializeObject <SkinModel>(skinJson);

            playerModel.realName = playerName;
            playerModel.age      = playerAge;
            playerModel.sex      = NAPI.Data.GetEntitySharedData(player, EntityData.PLAYER_SEX);

            PopulateCharacterSkin(player, skinModel);

            Task.Factory.StartNew(() =>
            {
                int playerId = Database.CreateCharacter(player, playerModel, skinModel);

                if (playerId > 0)
                {
                    InitializePlayerData(player);
                    NAPI.Entity.SetEntityTransparency(player, 255);
                    NAPI.Data.SetEntityData(player, EntityData.PLAYER_SQL_ID, playerId);
                    NAPI.Data.SetEntityData(player, EntityData.PLAYER_NAME, playerName);
                    NAPI.Data.SetEntityData(player, EntityData.PLAYER_AGE, playerAge);
                    NAPI.Data.SetEntitySharedData(player, EntityData.PLAYER_SPAWN_POS, new Vector3(200.6641f, -932.0939f, 30.6868f));
                    NAPI.Data.SetEntitySharedData(player, EntityData.PLAYER_SPAWN_ROT, new Vector3(0.0f, 0.0f, 0.0f));

                    Database.UpdateLastCharacter(player.SocialClubName, playerId);

                    NAPI.ClientEvent.TriggerClientEvent(player, "characterCreatedSuccessfully");
                }
            });
        }
コード例 #8
0
        public void CreateCharacterEvent(Client client, string playerName, Int16 playerAge, Boolean playerSex, string skinJson)
        {
            Task.Factory.StartNew(() =>
            {
                try
                {
                    PlayerModel playerModel = new PlayerModel();
                    SkinModel skinModel     = NAPI.Util.FromJson <SkinModel>(skinJson);
                    playerModel.Age         = playerAge;
                    playerModel.Sex         = playerSex;
                    // Apply the skin to the character
                    client.SetData(EntityData.PLAYER_SKIN_MODEL, skinModel);
                    Customization.ApplyPlayerCustomization(client, skinModel, playerSex);
                    int playerId = Database.CreateCharacter(client.SocialClubName, playerModel, skinModel);

                    if (playerId > 0)
                    {
                        // Database.UpdateLastCharacter(client.SocialClubName, playerId);
                        client.TriggerEvent("characterCreatedSuccessfully");
                    }
                }
                catch (Exception ex)
                {
                    Globals.log.Trace(ex);
                    NAPI.Util.ConsoleOutput("[EXCEPTION CreateCharacter] " + ex.Message);
                    NAPI.Util.ConsoleOutput("[EXCEPTION CreateCharacter] " + ex.StackTrace);
                }
            });
        }
コード例 #9
0
        public void CreateCharacterEvent(Client player, string playerName, int playerAge, int playerSex, string skinJson)
        {
            PlayerModel playerModel = new PlayerModel();
            SkinModel   skinModel   = NAPI.Util.FromJson <SkinModel>(skinJson);

            playerModel.realName = playerName;
            playerModel.age      = playerAge;
            playerModel.sex      = playerSex;

            // Apply the skin to the character
            player.SetData(EntityData.PLAYER_SKIN_MODEL, skinModel);
            Customization.ApplyPlayerCustomization(player, skinModel, playerSex);

            Task.Factory.StartNew(() =>
            {
                int playerId = Database.CreateCharacter(player, playerModel, skinModel);

                if (playerId > 0)
                {
                    InitializePlayerData(player);
                    player.Transparency = 255;
                    player.SetData(EntityData.PLAYER_SQL_ID, playerId);
                    player.SetData(EntityData.PLAYER_NAME, playerName);
                    player.SetData(EntityData.PLAYER_AGE, playerAge);
                    player.SetData(EntityData.PLAYER_SEX, playerSex);
                    player.SetSharedData(EntityData.PLAYER_SPAWN_POS, new Vector3(200.6641f, -932.0939f, 30.6868f));
                    player.SetSharedData(EntityData.PLAYER_SPAWN_ROT, new Vector3(0.0f, 0.0f, 0.0f));

                    Database.UpdateLastCharacter(player.SocialClubName, playerId);

                    player.TriggerEvent("characterCreatedSuccessfully");
                }
            });
        }
コード例 #10
0
        //private static string _currentSkinKey = "CurrentSkin";

        public SkinViewModel()
        {
            _model = new SkinModel();

            // CurrentSkin = (string)AssemblyConfigManager.Settings[_currentSkinKey];
            //if (!String.IsNullOrEmpty(CurrentSkin))
            //{
            //    LoadApplicationSkin(CurrentSkin);
            //}
            //else
            //{
            //    SkinManager.Current.LoadDefaultSkin();
            //    Perspective.Wpf.SkinManager.Current.LoadDefaultSkin();
            //    Perspective.Wpf3D.SkinManager.Current.LoadDefaultSkin();
            //}

            SetCurrentSkinCommand           = new SignalCommand();
            SetCurrentSkinCommand.Executed += (sender, e) =>
            {
                if ((e.Parameter != null) && (e.Parameter is string))
                {
                    CurrentSkin = e.Parameter as string;
                    // LoadApplicationSkin(CurrentSkin);
                    // AssemblyConfigManager.Settings[_currentSkinKey] = CurrentSkin;
                    // AssemblyConfigManager.SaveSettings();
                }
            };
        }
コード例 #11
0
        public void OnPlayerConnected(Client player)
        {
            // Initialize the player
            InitializePlayerData(player);
            InitializePlayerSkin(player);

            AccountModel account = Database.GetAccount(player.SocialClubName);

            switch (account.status)
            {
            case -1:
                NAPI.Chat.SendChatMessageToPlayer(player, Constants.COLOR_INFO + Messages.INF_ACCOUNT_DISABLED);
                NAPI.Player.KickPlayer(player, Messages.INF_ACCOUNT_DISABLED);
                break;

            case 0:
                NAPI.Chat.SendChatMessageToPlayer(player, Constants.COLOR_INFO + Messages.INF_ACCOUNT_NEW);
                NAPI.Player.KickPlayer(player, Messages.INF_ACCOUNT_NEW);
                break;

            default:
                // Welcome message
                String welcomeMessage = String.Format(Messages.GEN_WELCOME_MESSAGE, player.SocialClubName);
                NAPI.Chat.SendChatMessageToPlayer(player, welcomeMessage);
                NAPI.Chat.SendChatMessageToPlayer(player, Messages.GEN_WELCOME_HINT);
                NAPI.Chat.SendChatMessageToPlayer(player, Messages.GEN_HELP_HINT);
                NAPI.Chat.SendChatMessageToPlayer(player, Messages.GEN_TICKET_HINT);

                if (account.lastCharacter > 0)
                {
                    // Load selected character
                    PlayerModel character = Database.LoadCharacterInformationById(account.lastCharacter);
                    SkinModel   skin      = Database.GetCharacterSkin(account.lastCharacter);

                    String  pedModel = character.sex == 0 ? Constants.MALE_PED_MODEL : Constants.FEMALE_PED_MODEL;
                    PedHash pedHash  = NAPI.Util.PedNameToModel(pedModel);
                    NAPI.Player.SetPlayerName(player, character.realName);
                    NAPI.Player.SetPlayerSkin(player, pedHash);

                    LoadCharacterData(player, character);

                    PopulateCharacterSkin(player, skin);

                    Globals.PopulateCharacterClothes(player);
                }
                else
                {
                    PedHash pedHash = NAPI.Util.PedNameToModel(Constants.DEFAULT_PED_MODEL);
                    NAPI.Player.SetPlayerSkin(player, pedHash);
                }

                // Make the player invisible
                NAPI.Entity.SetEntityTransparency(player, 255);

                // Show login window and synchronize the time
                TimeSpan currentTime = TimeSpan.FromTicks(DateTime.Now.Ticks);
                NAPI.ClientEvent.TriggerClientEvent(player, "accountLoginForm", currentTime.Hours, currentTime.Minutes, currentTime.Seconds);
                break;
            }
        }
コード例 #12
0
        public void ChangeHairStyleEvent(Client player, String skinJson)
        {
            int           playerMoney = NAPI.Data.GetEntitySharedData(player, EntityData.PLAYER_MONEY);
            int           businessId  = NAPI.Data.GetEntityData(player, EntityData.PLAYER_BUSINESS_ENTERED);
            BusinessModel business    = GetBusinessById(businessId);
            int           price       = (int)Math.Round(business.multiplier * Constants.PRICE_BARBER_SHOP);

            if (playerMoney >= price)
            {
                int playerId = NAPI.Data.GetEntityData(player, EntityData.PLAYER_SQL_ID);

                // Getting the new hairstyle from the JSON
                dynamic skinModel = NAPI.Util.FromJson(skinJson);

                SkinModel skin = new SkinModel();
                skin.hairModel       = skinModel.hairModel;
                skin.firstHairColor  = skinModel.firstHairColor;
                skin.secondHairColor = skinModel.secondHairColor;
                skin.beardModel      = skinModel.beardModel;
                skin.beardColor      = skinModel.beardColor;
                skin.eyebrowsModel   = skinModel.eyebrowsModel;
                skin.eyebrowsColor   = skinModel.eyebrowsColor;

                // We update values in the database
                Database.UpdateCharacterHair(playerId, skin);

                // Saving new entity data
                NAPI.Data.SetEntitySharedData(player, EntityData.HAIR_MODEL, skin.hairModel);
                NAPI.Data.SetEntitySharedData(player, EntityData.FIRST_HAIR_COLOR, skin.firstHairColor);
                NAPI.Data.SetEntitySharedData(player, EntityData.SECOND_HAIR_COLOR, skin.secondHairColor);
                NAPI.Data.SetEntitySharedData(player, EntityData.BEARD_MODEL, skin.beardModel);
                NAPI.Data.SetEntitySharedData(player, EntityData.BEARD_COLOR, skin.beardColor);
                NAPI.Data.SetEntitySharedData(player, EntityData.EYEBROWS_MODEL, skin.eyebrowsModel);
                NAPI.Data.SetEntitySharedData(player, EntityData.EYEBROWS_COLOR, skin.eyebrowsColor);

                // Substract money to the player
                NAPI.Data.SetEntitySharedData(player, EntityData.PLAYER_MONEY, playerMoney - price);

                // We substract the product and add funds to the business
                if (business.owner != String.Empty)
                {
                    business.funds    += price;
                    business.products -= Constants.PRICE_BARBER_SHOP;
                    Database.UpdateBusiness(business);
                }

                // Confirmation message sent to the player
                String playerMessage = String.Format(Messages.INF_HAIRCUT_PURCHASED, price);
                NAPI.Chat.SendChatMessageToPlayer(player, Constants.COLOR_INFO + playerMessage);
            }
            else
            {
                String message = String.Format(Messages.ERR_HAIRCUT_MONEY, price);
                NAPI.Chat.SendChatMessageToPlayer(player, Constants.COLOR_ERROR + message);

                // Setting the old hairstyle to the player
                NAPI.ClientEvent.TriggerClientEvent(player, "cancelHairdressersChanges");
            }
        }
コード例 #13
0
        public void OnPlayerConnected(Client player)
        {
            // Set the default skin and transparency
            NAPI.Player.SetPlayerSkin(player, PedHash.Strperf01SMM);
            player.Transparency = 255;

            // Initialize the player data
            Character.InitializePlayerData(player);

            Task.Factory.StartNew(() =>
            {
                NAPI.Task.Run(() =>
                {
                    AccountModel account = Database.GetAccount(player.SocialClubName);

                    switch (account.status)
                    {
                    case -1:
                        player.SendChatMessage(Constants.COLOR_INFO + InfoRes.account_disabled);
                        player.Kick(InfoRes.account_disabled);
                        break;

                    case 0:
                        // Check if the account is registered or not
                        player.TriggerEvent(account.registered ? "accountLoginForm" : "showRegisterWindow");
                        break;

                    default:
                        // Welcome message
                        string welcomeMessage = string.Format(GenRes.welcome_message, player.SocialClubName);
                        player.SendChatMessage(welcomeMessage);
                        player.SendChatMessage(GenRes.welcome_hint);
                        player.SendChatMessage(GenRes.help_hint);
                        player.SendChatMessage(GenRes.ticket_hint);

                        if (account.lastCharacter > 0)
                        {
                            // Load selected character
                            PlayerModel character = Database.LoadCharacterInformationById(account.lastCharacter);
                            SkinModel skinModel   = Database.GetCharacterSkin(account.lastCharacter);

                            player.Name = character.realName;
                            player.SetData(EntityData.PLAYER_SKIN_MODEL, skinModel);
                            NAPI.Player.SetPlayerSkin(player, character.sex == 0 ? PedHash.FreemodeMale01 : PedHash.FreemodeFemale01);

                            Character.LoadCharacterData(player, character);
                            Customization.ApplyPlayerCustomization(player, skinModel, character.sex);
                            Customization.ApplyPlayerClothes(player);
                            Customization.ApplyPlayerTattoos(player);
                        }

                        // Activate the login window
                        player.SetSharedData(EntityData.SERVER_TIME, DateTime.Now.ToString("HH:mm:ss"));

                        break;
                    }
                });
            });
        }
コード例 #14
0
ファイル: BambooMan.cs プロジェクト: icxldd/BambooLauncher
        private async Task <bool> LoadLocalData()
        {
            LocalVerions = await Util.LoadLocalFileToObj <VersionsModel>("vers.dat");

            LocalSkin = await Util.LoadLocalFileToObj <SkinModel>("skin.dat");

            return(true);
        }
コード例 #15
0
ファイル: Game1.cs プロジェクト: superowner/FBXLoader
        //--------------
        #region D R A W
        //--------------
        protected override void Draw(GameTime gameTime)
        {
            gpu.SetRenderTarget(MainTarget);
            gpu.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.Transparent, 1.0f, 0);

            Set3DStates();

            //hero[IDLE].Draw(cam, skinFx.world);  // normal way

            // RENDER CHARACTER                    // specialized way
            SkinModel kid = hero[IDLE];

            for (int i = 0; i < kid.meshes.Length; i++)
            {
                SkinModel.SkinMesh mesh = kid.meshes[i];
                if (mesh.opacity < 0.6f)
                {
                    continue;
                }
                skinFx.SetDiffuseCol(Color.White.ToVector4());
                skinFx.SetSpecularCol(new Vector3(0.2f, 0.3f, 0.05f));
                skinFx.SetSpecularPow(256f);
                skinFx.world = mtx_hero_rotate * Matrix.CreateTranslation(hero_pos); // ***MUST DO THIS BEFORE: SET DRAW PARAMS***
                // (If we wanted, we could swap out a shirt or something by setting skinFx.texture = ...)
                // TO DO: set up a DrawMesh that takes a custom transforms list for animation blending
                kid.DrawMesh(i, cam, skinFx.world, false, false);
            }
            //RENDER SHINY TRANSPARENT STUFF(eyes )
            skinFx.SetShineAmplify(100f);
            for (int i = 0; i < kid.meshes.Length; i++)
            {
                SkinModel.SkinMesh mesh = kid.meshes[i];
                if (mesh.opacity >= 0.6f)
                {
                    continue;
                }
                // Make adjustments for eyes:
                float oldAlpha = skinFx.alpha;
                skinFx.alpha = 0.2f;
                skinFx.SetDiffuseCol(Color.Blue.ToVector4());
                skinFx.SetSpecularCol(new Vector3(100f, 100f, 100f));
                // TO DO: custom DrawMesh that takes a custom blendTransform
                hero[IDLE].DrawMesh(i, cam, skinFx.world, false);
                skinFx.alpha = oldAlpha;
            }
            skinFx.SetShineAmplify(1f);



            // DRAW MAINTARGET TO BACKBUFFER -------------------------------------------------------------------------------------------------------
            gpu.SetRenderTarget(null);
            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Opaque, SamplerState.LinearWrap, DepthStencilState.None, RasterizerState.CullNone);
            spriteBatch.Draw(MainTarget, desktopRect, Color.White);
            spriteBatch.End();
            base.Draw(gameTime);
        }
コード例 #16
0
        public void OnPlayerConnected(Client player)
        {
            // Set the default skin and transparency
            NAPI.Player.SetPlayerSkin(player, PedHash.Strperf01SMM);
            player.Transparency = 255;

            // Initialize the player data
            InitializePlayerData(player);

            Task.Factory.StartNew(() =>
            {
                AccountModel account = Database.GetAccount(player.SocialClubName);

                switch (account.status)
                {
                case -1:
                    player.SendChatMessage(Constants.COLOR_INFO + Messages.INF_ACCOUNT_DISABLED);
                    player.Kick(Messages.INF_ACCOUNT_DISABLED);
                    break;

                case 0:
                    // Show the register window
                    player.TriggerEvent("showRegisterWindow");
                    break;

                default:
                    // Welcome message
                    string welcomeMessage = string.Format(Messages.GEN_WELCOME_MESSAGE, player.SocialClubName);
                    player.SendChatMessage(welcomeMessage);
                    player.SendChatMessage(Messages.GEN_WELCOME_HINT);
                    player.SendChatMessage(Messages.GEN_HELP_HINT);
                    player.SendChatMessage(Messages.GEN_TICKET_HINT);

                    if (account.lastCharacter > 0)
                    {
                        // Load selected character
                        PlayerModel character = Database.LoadCharacterInformationById(account.lastCharacter);
                        SkinModel skinModel   = Database.GetCharacterSkin(account.lastCharacter);

                        player.Name = character.realName;
                        player.SetData(EntityData.PLAYER_SKIN_MODEL, skinModel);
                        NAPI.Player.SetPlayerSkin(player, character.sex == 0 ? PedHash.FreemodeMale01 : PedHash.FreemodeFemale01);

                        LoadCharacterData(player, character);
                        Customization.ApplyPlayerCustomization(player, skinModel, character.sex);
                        Customization.ApplyPlayerClothes(player);
                        Customization.ApplyPlayerTattoos(player);
                    }

                    // Activate the login window
                    player.SetSharedData(EntityData.SERVER_TIME, DateTime.Now.ToString("HH:mm:ss"));

                    break;
                }
            });
        }
コード例 #17
0
 public ChangeSkinRequest(
     string accessToken,
     string uuid,
     SkinModel model,
     string url
     ) : base(accessToken, uuid)
 {
     Model = model;
     Url   = url;
 }
コード例 #18
0
ファイル: Customization.cs プロジェクト: xentripetal/XenRP
        public static void ApplyPlayerCustomization(Client player, SkinModel skinModel, int sex)
        {
            // Populate the head
            var headBlend = new HeadBlend();
            {
                headBlend.ShapeFirst  = Convert.ToByte(skinModel.firstHeadShape);
                headBlend.ShapeSecond = Convert.ToByte(skinModel.secondHeadShape);
                headBlend.SkinFirst   = Convert.ToByte(skinModel.firstSkinTone);
                headBlend.SkinSecond  = Convert.ToByte(skinModel.secondSkinTone);
                headBlend.ShapeMix    = skinModel.headMix;
                headBlend.SkinMix     = skinModel.skinMix;
            }

            // Get the hair and eyes colors
            var eyeColor        = Convert.ToByte(skinModel.eyesColor);
            var hairColor       = Convert.ToByte(skinModel.firstHairColor);
            var hightlightColor = Convert.ToByte(skinModel.secondHairColor);

            // Add the face features
            float[] faceFeatures =
            {
                skinModel.noseWidth, skinModel.noseHeight,      skinModel.noseLength,     skinModel.noseBridge,
                skinModel.noseTip,   skinModel.noseShift,       skinModel.browHeight,
                skinModel.browWidth, skinModel.cheekboneHeight, skinModel.cheekboneWidth, skinModel.cheeksWidth,
                skinModel.eyes,      skinModel.lips,            skinModel.jawWidth,
                skinModel.jawHeight, skinModel.chinLength,      skinModel.chinPosition,   skinModel.chinWidth,
                skinModel.chinShape, skinModel.neckWidth
            };

            // Populate the head overlays
            var headOverlays = new Dictionary <int, HeadOverlay>();

            for (var i = 0; i < Constants.MAX_HEAD_OVERLAYS; i++)
            {
                // Get the overlay model and color
                var overlayData = GetOverlayData(skinModel, i);

                // Create the overlay
                var headOverlay = new HeadOverlay();
                {
                    headOverlay.Index          = Convert.ToByte(overlayData[0]);
                    headOverlay.Color          = Convert.ToByte(overlayData[1]);
                    headOverlay.SecondaryColor = 0;
                    headOverlay.Opacity        = 1.0f;
                }

                // Add the overlay
                headOverlays[i] = headOverlay;
            }

            // Update the character's skin
            player.SetCustomization(sex == Constants.SEX_MALE, headBlend, eyeColor, hairColor, hightlightColor,
                                    faceFeatures, headOverlays, new Decoration[] { });
            player.SetClothes(2, skinModel.hairModel, 0);
        }
コード例 #19
0
ファイル: LoadDebugInfo.cs プロジェクト: superowner/FBXLoader
        // INFO MODEL NODE
        public void InfoModelNode(SkinModel model, SkinModel.ModelNode n, int tabLevel)
        {
            string ntab = "";

            for (int i = 0; i < tabLevel; i++)
            {
                ntab += "  ";
            }
            string rtab = "\n" + ntab;
            string msg  = "\n";

            msg += rtab + $"{n.name}  ";
            msg += rtab + $"|_children.Count: {n.children.Count} ";
            if (n.parent == null)
            {
                msg += $"|_parent: IsRoot ";
            }
            else
            {
                msg += $"|_parent: " + n.parent.name;
            }
            msg += rtab + $"|_hasARealBone: {n.hasRealBone} ";
            msg += rtab + $"|_isThisAMeshNode: {n.isMeshNode}";
            if (n.uniqueMeshBones.Count > 0)
            {
                msg += rtab + $"|_uniqueMeshBones.Count: {n.uniqueMeshBones.Count}  ";
                int i = 0;
                foreach (var bone in n.uniqueMeshBones)
                {
                    msg += rtab + $"|_node: {n.name}  lists  uniqueMeshBone[{i}] ...  meshIndex: {bone.meshIndex}  meshBoneIndex: {bone.boneIndex}   " + $"mesh[{bone.meshIndex}]bone[{bone.boneIndex}].Name: {model.meshes[bone.meshIndex].meshBones[bone.boneIndex].name}  " + $"in  mesh[{bone.meshIndex}].Name: {model.meshes[bone.meshIndex].Name}";
                    var nameToCompare = model.meshes[bone.meshIndex].meshBones[bone.boneIndex].name;
                    int j             = 0;
                    foreach (var anim in model.animations)
                    {
                        int k = 0;
                        foreach (var animNode in anim.animatedNodes)
                        {
                            if (animNode.nodeName == nameToCompare)
                            {
                                msg += rtab + $"|^has corresponding Animation[{j}].Node[{k}].Name: {animNode.nodeName}";
                            }
                            k++;
                        }
                        j++;
                    }
                    i++;
                }
            }
            Console.WriteLine(msg);
            for (int i = 0; i < n.children.Count; i++)
            {
                InfoModelNode(model, n.children[i], tabLevel + 1);
            }
        }
コード例 #20
0
 public UploadSkinRequest(
     string accessToken,
     string uuid,
     SkinModel model,
     byte[] file,
     string filename
     ) : base(accessToken, uuid)
 {
     Model    = model;
     File     = file;
     Filename = filename;
 }
コード例 #21
0
        /// <summary>
        /// Changes the player skin by upload This uploads a skin to Mojang&#39;s servers. It also sets the users skin. This works on legacy counts as well.
        /// </summary>
        /// <param name="strippedUuid">The player UUID without hyphens</param>
        /// <param name="file">The skin image in PNG format</param>
        /// <param name="model"></param>
        /// <returns></returns>
        public void UploadPlayerSkin(string strippedUuid, System.IO.Stream file, SkinModel model)
        {
            // verify the required parameter 'strippedUuid' is set
            if (strippedUuid == null)
            {
                throw new ApiException(400, "Missing required parameter 'strippedUuid' when calling UploadPlayerSkin");
            }

            // verify the required parameter 'file' is set
            if (file == null)
            {
                throw new ApiException(400, "Missing required parameter 'file' when calling UploadPlayerSkin");
            }


            var path = "/user/profile/{stripped_uuid}/skin";

            path = path.Replace("{format}", "json");
            path = path.Replace("{" + "stripped_uuid" + "}", ApiClient.ParameterToString(strippedUuid));

            var    queryParams  = new Dictionary <String, String>();
            var    headerParams = new Dictionary <String, String>();
            var    formParams   = new Dictionary <String, String>();
            var    fileParams   = new Dictionary <String, FileParameter>();
            String postBody     = null;

            if (model != null)
            {
                formParams.Add("model", ApiClient.ParameterToString(model));                                        // form parameter
            }
            if (file != null)
            {
                fileParams.Add("file", ApiClient.ParameterToFile("file", file));
            }

            // authentication setting, if any
            String[] authSettings = new String[] { "PlayerAccessToken" };

            // make the HTTP request
            IRestResponse response = (IRestResponse)ApiClient.CallApi(path, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, authSettings);

            if (((int)response.StatusCode) >= 400)
            {
                throw new ApiException((int)response.StatusCode, "Error calling UploadPlayerSkin: " + response.Content, response.Content);
            }
            else if (((int)response.StatusCode) == 0)
            {
                throw new ApiException((int)response.StatusCode, "Error calling UploadPlayerSkin: " + response.ErrorMessage, response.ErrorMessage);
            }

            return;
        }
コード例 #22
0
ファイル: Baler.cs プロジェクト: icxldd/BambooLauncher
        public void ResetSkinFile()
        {
            SkinModel skin = new SkinModel();

            skin.Controls = new List <SkinControlInfo>();
            skin.Controls.Add(new SkinControlInfo());
            skin.WindowSize = new Int32Rect(100, 200, 720, 1280);
            skin.Title      = "Bamboo Launcher";
            skin.SkinVer    = 0;
            Util.SaveObjToFile(skin, GetFullPath($"{BambooBalerDirName}/skin.dat"), true);

            Version.SkinVer = 0;
        }
コード例 #23
0
        public void ChangeHairStyleEvent(Client player, string skinJson)
        {
            int           playerMoney = player.GetSharedData(EntityData.PLAYER_MONEY);
            int           businessId  = player.GetData(EntityData.PLAYER_BUSINESS_ENTERED);
            BusinessModel business    = GetBusinessById(businessId);
            int           price       = (int)Math.Round(business.multiplier * Constants.PRICE_BARBER_SHOP);

            if (playerMoney >= price)
            {
                int playerId = player.GetData(EntityData.PLAYER_SQL_ID);

                // Getting the new hairstyle from the JSON
                SkinModel skinModel = NAPI.Util.FromJson <SkinModel>(skinJson);

                // Saving new entity data
                player.SetData(EntityData.PLAYER_SKIN_MODEL, skinModel);

                // Substract money to the player
                player.SetSharedData(EntityData.PLAYER_MONEY, playerMoney - price);

                Task.Factory.StartNew(() => {
                    NAPI.Task.Run(() =>
                    {
                        // We update values in the database
                        Database.UpdateCharacterHair(playerId, skinModel);

                        // We substract the product and add funds to the business
                        if (business.owner != string.Empty)
                        {
                            business.funds    += price;
                            business.products -= Constants.PRICE_BARBER_SHOP;
                            Database.UpdateBusiness(business);
                        }

                        // Delete the browser
                        player.TriggerEvent("destroyBrowser");

                        // Confirmation message sent to the player
                        string playerMessage = string.Format(InfoRes.haircut_purchased, price);
                        player.SendChatMessage(Constants.COLOR_INFO + playerMessage);
                    });
                });
            }
            else
            {
                // The player has not the required money
                string message = string.Format(ErrRes.haircut_money, price);
                player.SendChatMessage(Constants.COLOR_ERROR + message);
            }
        }
コード例 #24
0
 private void InitializeSkin()
 {
     if (!File.Exists(JmSkinChangedUtil.SkinConfigFilePath))
     {
         Directory.CreateDirectory(System.IO.Path.GetDirectoryName(JmSkinChangedUtil.SkinConfigFilePath));
         File.Create(JmSkinChangedUtil.SkinConfigFilePath).Close();
         var skinModel = new SkinModel(
             JmSkinChangedUtil.DefaultImageSkinArgs.Background
             , JmSkinChangedUtil.DefaultImageSkinPath
             , JmSkinChangedUtil.DefaultImageSkinArgs.IsImageBrush);
         JmSkinChangedUtil.Invoke(skinModel);
     }
     else
     {
         try
         {
             var   skinInfo     = File.ReadAllLines(JmSkinChangedUtil.SkinConfigFilePath);
             var   isImageBrush = Convert.ToBoolean(skinInfo[0]);
             Brush background   = null;
             if (isImageBrush)
             {
                 var imagePath = System.IO.Path.GetFullPath(skinInfo[1]);
                 if (!File.Exists(imagePath))
                 {
                     imagePath = JmSkinChangedUtil.DefaultImageSkinPath;
                 }
                 background = new Uri(imagePath, UriKind.RelativeOrAbsolute).ToImageBrush();
                 if (background == null)
                 {
                     return;
                 }
                 _isBackgroundOfImage = true;
             }
             else
             {
                 background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(skinInfo[1]));
             }
             JmSkinChangedUtil.Invoke(new SkinModel(background, skinInfo[1], isImageBrush));
         }
         catch
         {
             var skinModel = new SkinModel(
                 JmSkinChangedUtil.DefaultImageSkinArgs.Background
                 , JmSkinChangedUtil.DefaultImageSkinPath
                 , JmSkinChangedUtil.DefaultImageSkinArgs.IsImageBrush);
             JmSkinChangedUtil.Invoke(skinModel);
         }
     }
 }
コード例 #25
0
ファイル: Customization.cs プロジェクト: mayqick/EchoRP
        public static void ApplyPlayerCustomization(Client player, SkinModel skinModel, int sex)
        {
            // Устанавливаем настройки головы
            HeadBlend headBlend = new HeadBlend();

            headBlend.ShapeFirst  = Convert.ToByte(skinModel.firstHeadShape);
            headBlend.ShapeSecond = Convert.ToByte(skinModel.secondHeadShape);
            headBlend.SkinFirst   = Convert.ToByte(skinModel.firstSkinTone);
            headBlend.SkinSecond  = Convert.ToByte(skinModel.secondSkinTone);
            headBlend.ShapeMix    = skinModel.headMix;
            headBlend.SkinMix     = skinModel.skinMix;

            // Получаем волосы и цвет глаз
            byte eyeColor        = Convert.ToByte(skinModel.eyesColor);
            byte hairColor       = Convert.ToByte(skinModel.firstHairColor);
            byte hightlightColor = Convert.ToByte(skinModel.secondHairColor);

            // Устанавливаем черны лица
            float[] faceFeatures = new float[]
            {
                skinModel.noseWidth, skinModel.noseHeight, skinModel.noseLength, skinModel.noseBridge, skinModel.noseTip, skinModel.noseShift, skinModel.browHeight,
                skinModel.browWidth, skinModel.cheekboneHeight, skinModel.cheekboneWidth, skinModel.cheeksWidth, skinModel.eyes, skinModel.lips, skinModel.jawWidth,
                skinModel.jawHeight, skinModel.chinLength, skinModel.chinPosition, skinModel.chinWidth, skinModel.chinShape, skinModel.neckWidth
            };


            Dictionary <int, HeadOverlay> headOverlays = new Dictionary <int, HeadOverlay>();

            for (int i = 0; i < Constants.MAX_HEAD_OVERLAYS; i++)
            {
                int[] overlayData = GetOverlayData(skinModel, i);

                HeadOverlay headOverlay = new HeadOverlay();
                headOverlay.Index          = Convert.ToByte(overlayData[0]);
                headOverlay.Color          = Convert.ToByte(overlayData[1]);
                headOverlay.SecondaryColor = 0;
                headOverlay.Opacity        = 1.0f;

                headOverlays[i] = headOverlay;
            }

            // Обновляем скин персонажа
            player.SetCustomization(sex == Constants.SEX_MALE, headBlend, eyeColor, hairColor, hightlightColor, faceFeatures, headOverlays, new Decoration[] { });
            player.SetClothes(2, skinModel.hairModel, 0);
        }
コード例 #26
0
        public JsonResult Cadastrar(SkinModel vm)
        {
            try
            {
                Skin skinRetorno;


                using (var db = new SkinsContext())


                    if (db.Skins.Any())
                    {
                        var id = db.Skins.OrderByDescending(x => x.Id).First().Id;

                        var item = new Skin(vm)
                        {
                            Id = id + 1
                        };

                        db.Skins.Add(item);

                        db.SaveChanges();

                        skinRetorno = item;
                    }
                    else
                    {
                        var item = new Skin(vm);

                        db.Skins.Add(item);

                        db.SaveChanges();

                        skinRetorno = item;
                    }

                return(Json(new { Sucesso = true, Mensagem = "Sucesso", Dados = skinRetorno }));
            }
            catch (Exception)
            {
                return(Json(new { Sucesso = false, Mensagem = "Erro" }));
            }
        }
コード例 #27
0
        public void LoadCharacterEvent(Client player, String name)
        {
            PlayerModel playerModel = Database.LoadCharacterInformationByName(name);
            SkinModel   skinModel   = Database.GetCharacterSkin(playerModel.id);

            // Load player's model
            String  pedModel = playerModel.sex == 0 ? Constants.MALE_PED_MODEL : Constants.FEMALE_PED_MODEL;
            PedHash pedHash  = NAPI.Util.PedNameToModel(pedModel);

            NAPI.Player.SetPlayerName(player, playerModel.realName);
            NAPI.Player.SetPlayerSkin(player, pedHash);

            LoadCharacterData(player, playerModel);
            PopulateCharacterSkin(player, skinModel);
            Globals.PopulateCharacterClothes(player);

            // Update last selected character
            Database.UpdateLastCharacter(player.SocialClubName, playerModel.id);
        }
コード例 #28
0
        public void LoadCharacterEvent(Client player, String name)
        {
            Task.Factory.StartNew(() =>
            {
                PlayerModel playerModel = Database.LoadCharacterInformationByName(name);
                SkinModel skinModel     = Database.GetCharacterSkin(playerModel.id);

                // Load player's model
                NAPI.Player.SetPlayerName(player, playerModel.realName);
                NAPI.Player.SetPlayerSkin(player, playerModel.sex == 0 ? PedHash.FreemodeMale01 : PedHash.FreemodeFemale01);

                LoadCharacterData(player, playerModel);
                PopulateCharacterSkin(player, skinModel);
                Globals.PopulateCharacterClothes(player);

                // Update last selected character
                Database.UpdateLastCharacter(player.SocialClubName, playerModel.id);
            });
        }
コード例 #29
0
ファイル: LoadDebugInfo.cs プロジェクト: superowner/FBXLoader
 public void DisplayInfo(SkinModel model, string filePath)
 {
     if (ld.LoadedModelInfo)
     {
         Console.Write("\n\n\n\n****************************************************");
         Console.WriteLine("\n\n@@@DisplayInfo \n \n");
         Console.WriteLine("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
         Console.WriteLine("Model");
         Console.WriteLine("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); Console.WriteLine();
         Console.WriteLine("FileName");
         Console.WriteLine(ld.GetFileName(filePath, true)); Console.WriteLine();
         Console.WriteLine("Path:");
         Console.WriteLine(filePath); Console.WriteLine();
         Console.WriteLine("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
         Console.WriteLine("Animations");
         Console.WriteLine("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); Console.WriteLine("");
         for (int i = 0; i < ld.scene.Animations.Count; i++)
         {
             var anim = ld.scene.Animations[i];
             Console.WriteLine($"_____________________________________");
             Console.WriteLine($"Anim #[{i}] Name: {anim.Name}");
             Console.WriteLine($"_____________________________________");
             Console.WriteLine($"  Duration: {anim.DurationInTicks} / {anim.TicksPerSecond} sec.   total duration in seconds: {anim.DurationInTicks / anim.TicksPerSecond}");
             Console.WriteLine($"  Node Animation Channels: {anim.NodeAnimationChannelCount} ");
             Console.WriteLine($"  Mesh Animation Channels: {anim.MeshAnimationChannelCount} ");
             Console.WriteLine($"  Mesh Morph     Channels: {anim.MeshMorphAnimationChannelCount} ");
         }
         Console.WriteLine();
         Console.WriteLine("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
         Console.WriteLine("Node Heirarchy");
         Console.WriteLine("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); Console.WriteLine("");
         InfoModelNode(model, model.rootNodeOfTree, 0); Console.WriteLine("");
         Console.WriteLine("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
         Console.WriteLine("Meshes and Materials");
         Console.WriteLine("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); Console.WriteLine("");
         InfoForMeshMaterials(model, ld.scene); Console.WriteLine("");
     }
     if (ld.MinimalInfo || ld.LoadedModelInfo)
     {
         MinimalInfo(model, filePath);
     }
 }
コード例 #30
0
        public SkinModel[] Map(GeneralChampionsSkinsClientModel s)
        {
            SkinModel firstModel = new SkinModel
            {
                PaladinsChampionId = Convert.ToInt32(s.ChampionId),
                PaladinsSkinId     = Convert.ToInt32(s.SkinId1),
                Rarity             = s.Rarity,
                SkinName           = s.SkinName,
            };

            SkinModel secondModel = new SkinModel
            {
                PaladinsChampionId = Convert.ToInt32(s.ChampionId),
                PaladinsSkinId     = Convert.ToInt32(s.SkinId2),
                Rarity             = s.Rarity,
                SkinName           = s.SkinName,
            };

            return(new SkinModel[] { firstModel, secondModel });
        }