/// <summary>
        ///     The client wants to know whether we already have baked textures for the given items
        /// </summary>
        /// <param name="client"></param>
        /// <param name="args"></param>
        void AgentCachedTexturesRequest(IClientAPI client, List <CachedAgentArgs> args)
        {
            IScenePresence          sp  = m_scene.GetScenePresence(client.AgentId);
            IAvatarAppearanceModule app = sp.RequestModuleInterface <IAvatarAppearanceModule> ();
            // Look up hashes to make sure that the request is valid

            List <CachedAgentArgs> resp = new List <CachedAgentArgs> ();

            foreach (CachedAgentArgs arg in args)
            {
                CachedAgentArgs r = new CachedAgentArgs();
                r.TextureIndex = arg.TextureIndex;
                //V2 changed to send the actual texture index, and not the baked texture index
                int index = arg.TextureIndex >= 5
                    ? arg.TextureIndex
                    : (int)AppearanceManager.BakeTypeToAgentTextureIndex((BakeType)arg.TextureIndex);

                r.ID = (
                    app.Appearance.Texture.FaceTextures [index] == null ||
                    app.Appearance.WearableCache.Count == 0 ||
                    !app.Appearance.WearableCache.ContainsKey(index.ToString()) ||
                    app.Appearance.WearableCache [index.ToString()] != arg.ID
                        ? UUID.Zero
                        : app.Appearance.Texture.FaceTextures [index].TextureID);

                resp.Add(r);
            }

            client.SendAgentCachedTexture(resp);
        }
示例#2
0
        /// <summary>
        /// Performs the installation in the Castle.Windsor.IWindsorContainer.
        /// </summary>
        /// <param name="container"></param>
        /// <param name="store"></param>
        public void Install(IWindsorContainer container,
                            IConfigurationStore store)
        {
            try
            {
                string fullPath = System.Reflection.Assembly.GetAssembly(typeof(Installers)).Location;
                string dir      = System.IO.Path.GetDirectoryName(fullPath);

                // register components in this DLL and make them available here
                container.Install(FromAssembly.Named(System.IO.Path.Combine(dir, "Settings.dll")));
                container.Install(FromAssembly.Named(System.IO.Path.Combine(dir, "XmlExplorerVMLib.dll")));
            }
            catch (Exception exp)
            {
                Logger.Error(exp);
            }

            container.Register(Component.For <IAppearanceManager>()
                               .Instance(AppearanceManager.GetInstance()).LifestyleSingleton());

            // Register settings service component to help castle satisfy dependencies on it
            container
            .Register(Component.For <IAppLifeCycleViewModel>()
                      .ImplementedBy <AppLifeCycleViewModel>().LifestyleSingleton());

            // Register settings service component to help castle satisfy dependencies on it
            container
            .Register(Component.For <IThemesManagerViewModel>()
                      .ImplementedBy <ThemesManagerViewModel>().LifestyleSingleton());

            // Register application viewmodel to help castle satisfy dependencies on it
            container
            .Register(Component.For <IAppViewModel>()
                      .ImplementedBy <AppViewModel>().LifestyleSingleton());
        }
        public AppearanceManagerViewModel(IAppearanceSettings settings)
        {
            _settings = settings;

            _themes        = new ObservableCollection <ThemeResource>(AppearanceManager.GetThemes());
            _selectedTheme = (from t in _themes where t.Name == _settings.Theme select t).FirstOrDefault();

            if (_selectedTheme == null)
            {
                SelectedTheme = CurrentTheme;
            }
            SelectedTheme.Apply();

            _accents         = new ObservableCollection <AccentResource>(AppearanceManager.GetAccents());
            _accentGroups    = new ObservableCollection <string>((from a in _accents orderby a.SortOrder ascending select a.AccentGroup).Distinct().ToList());
            _accentGroupings = new CollectionViewSource {
                Source = _accents
            };
            _accentGroupings.Filter += AccentGroupingsOnFilter;
            _accentGroupings.SortDescriptions.Add(new SortDescription("SortOrder", ListSortDirection.Ascending));

            _selectedAccent = (from a in _accents where a.Name == _settings.Accent select a).FirstOrDefault();

            if (_selectedAccent == null)
            {
                SelectedAccent = CurrentAccent;
            }
            SelectedAccent.Apply();

            ApplyCommand  = new DelegateCommand(Apply, CanExecuteApply);
            CancelCommand = new DelegateCommand(Cancel, CanExecuteCancel);
        }
示例#4
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            SaveSystem.GameReady  += () => Dispatcher.Invoke(() => PopulateAppLauncher());
            Shiftorium.Installed  += () => Dispatcher.Invoke(() => PopulateAppLauncher());
            SkinEngine.SkinLoaded += () => Dispatcher.Invoke(() => PopulateAppLauncher());


            onWindowShow += (brdr) =>
            {
                brdr.Measure(windowlayer.DesiredSize);
                brdr.SetValue(System.Windows.Controls.Canvas.LeftProperty, (windowlayer.ActualWidth - brdr.Width) / 2);
                brdr.SetValue(System.Windows.Controls.Canvas.TopProperty, (windowlayer.ActualHeight - brdr.ActualActualHeight) / 2);
                windowlayer.Children.Add(brdr);
                brdr.PreviewMouseDown += (o, a) =>
                {
                    brdr.BringToFront(windowlayer);
                };
            };
            onWindowClose += (brdr) =>
            {
                if (windowlayer.Children.Contains(brdr))
                {
                    windowlayer.Children.Remove(brdr);
                    brdr.ParentWindow.OnUnload();
                    brdr = null;
                }
            };
            AppearanceManager.SetupWindow(new Terminal());
        }
示例#5
0
        private void btnlogin_Click(object sender, EventArgs e)
        {
            string sys   = txtsys.Text;
            string uname = txtuname.Text;
            string root  = txtroot.Text;

            // validation

            if (string.IsNullOrWhiteSpace(sys))
            {
                Infobox.Show("{TITLE_EMPTY_SYSNAME}", "{MSG_EMPTY_SYSNAME}");
                return;
            }

            if (sys.Length < 5)
            {
                Infobox.Show("{TITLE_VALIDATION_ERROR}", "{MSG_VALIDATION_ERROR_SYSNAME_LENGTH}");
                return;
            }

            if (string.IsNullOrWhiteSpace(uname))
            {
                Infobox.Show("{TITLE_VALIDATION_ERROR}", "You must provide a username.");
                return;
            }

            Callback?.Invoke(new SignupCredentials
            {
                SystemName   = sys,
                Username     = uname,
                RootPassword = root
            });
            AppearanceManager.Close(this);
        }
示例#6
0
        private Dictionary <BakeType, Primitive.TextureEntryFace> GetBakedTextureFaces(ScenePresence sp)
        {
            if (sp.IsChildAgent)
            {
                return(new Dictionary <BakeType, Primitive.TextureEntryFace>());
            }

            Dictionary <BakeType, Primitive.TextureEntryFace> bakedTextures
                = new Dictionary <BakeType, Primitive.TextureEntryFace>();

            AvatarAppearance appearance = sp.Appearance;

            Primitive.TextureEntryFace[] faceTextures = appearance.Texture.FaceTextures;

            foreach (int i in Enum.GetValues(typeof(BakeType)))
            {
                BakeType bakeType = (BakeType)i;

                if (bakeType == BakeType.Unknown)
                {
                    continue;
                }

//                m_log.DebugFormat(
//                    "[AVFACTORY]: NPC avatar {0} has texture id {1} : {2}",
//                    acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]);

                int ftIndex = (int)AppearanceManager.BakeTypeToAgentTextureIndex(bakeType);
                Primitive.TextureEntryFace texture = faceTextures[ftIndex];    // this will be null if there's no such baked texture
                bakedTextures[bakeType] = texture;
            }

            return(bakedTextures);
        }
示例#7
0
 /// <summary>
 /// Constructs a new object.
 /// </summary>
 /// <param name="channel"></param>
 public Player(IChannel channel)
 {
     this.channel      = channel;
     interfaceManager  = new InterfaceManager(this);
     socialManager     = new SocialManager(this);
     appearanceManager = new AppearanceManager(this);
 }
示例#8
0
        private void btnconfirm_Click(object sender, RoutedEventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(txtfilename.Text))
            {
                if (!txtfilename.Text.EndsWith(filter.SelectedItem.ToString()))
                {
                    txtfilename.Text += filter.SelectedItem.ToString();
                }

                switch (OpenerStyle)
                {
                case FileOpenerStyle.Open:
                    if (Utils.FileExists(currentFolder + "/" + txtfilename.Text))
                    {
                        Callback?.Invoke(currentFolder + "/" + txtfilename.Text);
                        AppearanceManager.Close(this);
                    }
                    else
                    {
                        Infobox.Show("File not found", $"The file {currentFolder}/{txtfilename.Text} was not found.");
                    }
                    break;

                case FileOpenerStyle.Save:
                    Callback?.Invoke(currentFolder + "/" + txtfilename.Text);
                    AppearanceManager.Close(this);
                    break;
                }
            }
            else
            {
                Infobox.Show("File Skimmer", "Please provide a filename.");
            }
        }
示例#9
0
        /// <summary>
        /// Default constructor
        /// </summary>
        public GridClient()
        {
            // Initialise SmartThreadPool when using mono
            if (Type.GetType("Mono.Runtime") != null)
            {
                WorkPool.Init(true);
            }

            // These are order-dependant
            Network    = new NetworkManager(this);
            Settings   = new Settings(this);
            Parcels    = new ParcelManager(this);
            Self       = new AgentManager(this);
            Avatars    = new AvatarManager(this);
            Estate     = new EstateTools(this);
            Friends    = new FriendsManager(this);
            Grid       = new GridManager(this);
            Objects    = new ObjectManager(this);
            Groups     = new GroupManager(this);
            Assets     = new AssetManager(this);
            Appearance = new AppearanceManager(this);
            Inventory  = new InventoryManager(this);
            Directory  = new DirectoryManager(this);
            Terrain    = new TerrainManager(this);
            Sound      = new SoundManager(this);
            Throttle   = new AgentThrottle(this);
            Stats      = new OpenMetaverse.Stats.UtilizationStatistics();
        }
示例#10
0
        internal void Launch()
        {
            _loginControl = new LoginControl();

            var control = new ContentControl()
            {
                Content = _loginControl
            };

            AnimatedDialog dialog = new AnimatedDialog(
                new Point(0, 0),
                BalloonPopupPosition.ScreenCenter,
                control,
                50, true, true, null, null)
            {
                ShowHeaderPanel = true,
                ShowTickButton  = false
            };

            _loginControl.Closed += (s, e) => { dialog.Close(); };

            dialog.ShowCloseButton     = true;
            dialog.ShowMaximizeRestore = false;
            dialog.Topmost             = false;
            AppearanceManager.SetAppearance(dialog);
            dialog.Show();
        }
示例#11
0
        public void OpenDirectory(string path)
        {
            var fs = new Applications.FileSkimmer();

            AppearanceManager.SetupWindow(fs);
            fs.ChangeDirectory(path);
        }
示例#12
0
        public void OpenFile(string path)
        {
            bool opened = true;

            string ext = path.Split('.')[path.Split('.').Length - 1];

            switch (ext)
            {
            case "txt":
                if (Shiftorium.UpgradeInstalled("textpad_open"))
                {
                    var txt = new TextPad();
                    txt.LoadFile(path);
                    AppearanceManager.SetupWindow(txt);
                }
                else
                {
                    opened = false;
                }
                break;

            case "pic":
            case "png":
            case "jpg":
            case "bmp":

                break;

            case "wav":
            case "mp3":

                break;

            case "lua":

                break;

            case "py":

                break;

            case "skn":

                break;

            case "mfs":
                Utils.MountPersistent(path);
                string mount = (Utils.Mounts.Count - 1).ToString() + ":";
                OpenDirectory(mount);
                break;

            default:
                opened = false;
                break;
            }
            if (opened == false)
            {
                Infobox.Show("File Skimmer - Can't open file", "File Skimmer can't find an application to open this file!");
            }
        }
示例#13
0
        /// <summary>
        /// Default constructor
        /// </summary>
        public GridClient()
        {
            // These are order-dependant
            Network    = new NetworkManager(this);
            Settings   = new Settings(this);
            Parcels    = new ParcelManager(this);
            Self       = new AgentManager(this);
            Avatars    = new AvatarManager(this);
            Friends    = new FriendsManager(this);
            Grid       = new GridManager(this);
            Objects    = new ObjectManager(this);
            Groups     = new GroupManager(this);
            Assets     = new AssetManager(this);
            Appearance = new AppearanceManager(this, Assets);
            Inventory  = new InventoryManager(this);
            Directory  = new DirectoryManager(this);
            Terrain    = new TerrainManager(this);
            Sound      = new SoundManager(this);
            Throttle   = new AgentThrottle(this);

            //if (Settings.ENABLE_INVENTORY_STORE)
            //    InventoryStore = new Inventory(Inventory);
            //if (Settings.ENABLE_LIBRARY_STORE)
            //    LibraryStore = new Inventory(Inventory);

            //Inventory.OnSkeletonsReceived +=
            //    delegate(InventoryManager manager)
            //    {
            //        if (Settings.ENABLE_INVENTORY_STORE)
            //            InventoryStore.InitializeFromSkeleton(Inventory.InventorySkeleton);
            //        if (Settings.ENABLE_LIBRARY_STORE)
            //            LibraryStore.InitializeFromSkeleton(Inventory.LibrarySkeleton);
            //    };
        }
示例#14
0
        public void Launch()
        {
            StockApplicationWindow w = new StockApplicationWindow()
            {
                WindowBackground      = AppearanceManager.GetCurrentSkinResource("BackgroundBase_02") as Brush,
                TopPanelBackground    = AppearanceManager.GetCurrentSkinResource("BackgroundBase_04") as Brush,
                BottomPanelBackground = AppearanceManager.GetCurrentSkinResource("BackgroundBase_02") as Brush,
                SideToolbarBackground = AppearanceManager.GetCurrentSkinResource("BackgroundBase_05") as Brush,
                TopPanelHeight        = 55,
                BottomPanelHeight     = 65,
                TopStripHeight        = 10,
                BottomStripHeight     = 5,
                WindowHeaderIcon      = (ImageSource) new ImageSourceConverter().ConvertFromString("./Images/Klingelnberg/Klingelnberg_Logo.png"),
                WindowHeader          = "Klipper",
                ShowSideToolbar       = true,
                WindowState           = WindowState.Normal
            };

            AppearanceManager.CurrentSkin = SkinType.OrangeOnBlack;
            w.WindowState = System.Windows.WindowState.Normal;
            w.Topmost     = false;

            //Register and unregister events on MainConnector
            w.Closed += (s, e) =>
            {
                MainConnector.Instance.HandleWindowClose();
            };

            _appWindow = w;

            MainConnector.Instance.Ui = w;
            MainConnector.Instance.Initialize();

            w.Show();
        }
示例#15
0
        public void Open(string title, string msg)
        {
            Dialog frm = new Dialog();

            frm.Text = title;
            var pnl   = new Panel();
            var flow  = new FlowLayoutPanel();
            var btnok = new Button();

            btnok.AutoSize     = true;
            btnok.AutoSizeMode = AutoSizeMode.GrowAndShrink;
            flow.Height        = btnok.Height + 4;
            btnok.Text         = "ok";
            flow.Dock          = DockStyle.Bottom;
            flow.Controls.Add(btnok);
            btnok.Show(); btnok.Click += (o, a) =>
            {
                frm.Close();
            };
            pnl.Controls.Add(flow);
            flow.Show();
            var lbl = new Label();

            lbl.Text      = msg;
            lbl.TextAlign = ContentAlignment.MiddleCenter;
            lbl.Dock      = DockStyle.Fill;
            lbl.AutoSize  = false;
            pnl.Controls.Add(lbl); lbl.Show();
            frm.Controls.Add(pnl);
            pnl.Dock = DockStyle.Fill;
            frm.Size = new Size(320, 200);
            AppearanceManager.SetupDialog(frm);
        }
示例#16
0
        /// <summary>
        /// 
        /// </summary>
        public TestClient(ClientManager manager)
        {
			ClientManager = manager;

            NewAssetManager = new AssetManager(this);
            NewAppearanceManager = new AppearanceManager(this, NewAssetManager);

            updateTimer = new System.Timers.Timer(1000);
            updateTimer.Elapsed += new System.Timers.ElapsedEventHandler(updateTimer_Elapsed);

            RegisterAllCommands(Assembly.GetExecutingAssembly());

            Settings.DEBUG = true;
            Settings.STORE_LAND_PATCHES = true;
            Settings.ALWAYS_REQUEST_OBJECTS = true;

            Network.RegisterCallback(PacketType.AgentDataUpdate, new NetworkManager.PacketCallback(AgentDataUpdateHandler));

            Objects.OnNewPrim += new ObjectManager.NewPrimCallback(Objects_OnNewPrim);
            Objects.OnObjectUpdated += new ObjectManager.ObjectUpdatedCallback(Objects_OnObjectUpdated);
            Objects.OnObjectKilled += new ObjectManager.KillObjectCallback(Objects_OnObjectKilled);
			Objects.OnNewAvatar += new ObjectManager.NewAvatarCallback(Objects_OnNewAvatar);
            Self.OnInstantMessage += new MainAvatar.InstantMessageCallback(Self_OnInstantMessage);
            Groups.OnGroupMembers += new GroupManager.GroupMembersCallback(GroupMembersHandler);
            this.OnLogMessage += new LogCallback(TestClient_OnLogMessage);

            Network.RegisterCallback(PacketType.AvatarAppearance, new NetworkManager.PacketCallback(AvatarAppearanceHandler));
            
            updateTimer.Start();
        }
示例#17
0
        public void OpenFile(string path)
        {
            var stpInstall = new StpInstallation(path);

            AppearanceManager.SetupWindow(this);
            InitiateInstall(stpInstall);
        }
        public void Launch()
        {
            StockApplicationWindow w = new StockApplicationWindow()
            {
                WindowBackground      = AppearanceManager.GetCurrentSkinResource("BackgroundBase_02") as Brush,
                TopPanelBackground    = AppearanceManager.GetCurrentSkinResource("BackgroundBase_04") as Brush,
                BottomPanelBackground = AppearanceManager.GetCurrentSkinResource("BackgroundBase_02") as Brush,
                SideToolbarBackground = AppearanceManager.GetCurrentSkinResource("BackgroundBase_05") as Brush,
                TopPanelHeight        = 55,
                BottomPanelHeight     = 65,
                TopStripHeight        = 10,
                BottomStripHeight     = 5,
                WindowHeaderIcon      = (ImageSource) new ImageSourceConverter().ConvertFromString("./Images/Klingelnberg/Klingelnberg_Logo.png"),
                WindowHeader          = "Klipper",
                ShowSideToolbar       = true,
                WindowState           = WindowState.Normal
            };

            LoadNavigator(w);
            LoadTopPanel(w);
            LoadBottomPanel(w);
            LoadSideToolbar(w);

            w.WindowState = System.Windows.WindowState.Maximized;
            w.Topmost     = true;

            w.Show();
        }
示例#19
0
        public dynamic createWindow(string name, dynamic size)
        {
            var win = new Window();

            win.Size = size;
            AppearanceManager.SetupWindow(win);
            return(win);
        }
示例#20
0
 private void btnimport_Click(object sender, EventArgs e)
 {
     AppearanceManager.SetupDialog(new FileDialog(new[] { ".skn" }, FileOpenerStyle.Open, new Action <string>((filename) =>
     {
         LoadedSkin = JsonConvert.DeserializeObject <Skin>(ShiftOS.Objects.ShiftFS.Utils.ReadAllText(filename));
         SetupUI();
     })));
 }
        public override string Execute(string[] args, LLUUID fromAgentID)
        {
            if (aManager == null)
                aManager = new AppearanceManager(Client);

            aManager.SendAgentSetAppearance();
            return "Done.";
        }
示例#22
0
        //private void DirectoryExplorerOnTargetUpdated(object sender, DataTransferEventArgs e, bool target)
        //{
        //    var propertyName = e.Property.Name;

        //    switch (propertyName)
        //    {
        //        case nameof(DirectoryExplorer.SelectedItem):
        //            Debug.WriteLine("{1} {0} {1}", propertyName, DirectoryExplorer.SelectedItem,
        //                "=========================");
        //            var binding = DirectoryExplorer.GetBindingExpression(FileSystemExplorerListControl.SelectedItemProperty);
        //            if (target)
        //            {
        //                this.ViewModel.SelectedDirectory = DirectoryExplorer.SelectedItem;
        //                binding?.UpdateSource();
        //            }
        //            //this.ViewModel.OnPropertyChanged(nameof(ViewModel.SelectedDirectory));
        //            break;
        //    }
        //}

        //private void DirectoryExplorerOnPropertyChanged(object sender, PropertyChangedEventArgs e)
        //{
        //    var propertyName = e.PropertyName;
        //    switch (propertyName)
        //    {
        //        case nameof(DirectoryExplorer.SelectedItem):
        //            Debug.WriteLine("{1} {0} {1}", propertyName, DirectoryExplorer.SelectedItem,
        //                "-------------------------");
        //            var binding = DirectoryExplorer.GetBindingExpression(FileSystemExplorerListControl.SelectedItemProperty);
        //            this.ViewModel.OnPropertyChanged(nameof(ViewModel.SelectedDirectory));
        //            break;
        //    }
        //}

        #region Initialization

        private void MainWindow_OnInitialized(object sender, EventArgs e)
        {
            ViewModel.Settings.Theme.Current = TelerikThemes.VisualStudio2013.Blue;
            AppearanceManager.RegisterComponent <SwitchButton>();
            AppearanceManager.RegisterComponent <CollectionEditor>();
            AppearanceManager.RegisterSource <RadBreadcrumb>();
            LoadTheme();
        }
示例#23
0
 private void panel1_Click(object sender, EventArgs e)
 {
     AppearanceManager.SetupDialog(new ColorPicker(panel1.BackColor, "Text Color", new Action <Color>((col) =>
     {
         panel1.ForeColor = col;
         panel1.BackColor = col;
     })));
 }
示例#24
0
 private void wbmain_NewWindow(object sender, CancelEventArgs e)
 {
     e.Cancel = true;
     if (Shiftorium.UpgradeInstalled("web_browser_new_window"))
     {
         AppearanceManager.SetupWindow(new WebBrowser());
     }
 }
        private void themeComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            MetroThemeStyle newTheme = (MetroThemeStyle)themeComboBox.SelectedItem;

            AppearanceManager.SetThemeOnForms(newTheme, this, _shellForm);

            AppearanceManager.SaveSettings(_shellForm.BaseMetroStyleManager);
        }
示例#26
0
 public void OnLoad()
 {
     if (!string.IsNullOrWhiteSpace(Title))
     {
         AppearanceManager.SetWindowTitle(this, this.Title);
     }
     ShiftOS.Engine.AudioManager.PlayStream(Properties.Resources.infobox);
 }
示例#27
0
            protected void HandleLoadedModel(PlayerEntity player, GameObject obj)
            {
                obj.layer = UnityLayerManager.GetLayerIndex(EUnityLayerName.Player);
                PlayerEntityUtility.DisableCollider(obj.transform);

                if (!player.hasCharacterContoller)
                {
                    var character = DefaultGo.CreateGameObject(player.entityKey.ToString());
                    character.layer = UnityLayerManager.GetLayerIndex(EUnityLayerName.Player);
                    CharacterController        cc  = PlayerEntityUtility.InitCharacterController(character);
                    KinematicCharacterMotor    kcc = PlayerEntityUtility.InitKinematicCharacterMotor(character);
                    CharacterControllerContext characterControllerContext = new CharacterControllerContext(
                        new UnityCharacterController(cc, !player.isFlagSelf),
                        new Core.CharacterController.ConcreteController.ProneCharacterController(kcc,
                                                                                                 new ProneController()),
                        new Core.CharacterController.ConcreteController.DiveCharacterController(kcc,
                                                                                                new DiveController()),
                        new Core.CharacterController.ConcreteController.SwimCharacterController(kcc,
                                                                                                new SwimController())
                        );


                    var curver = character.AddComponent <AirMoveCurve>();
                    curver.AireMoveCurve = SingletonManager.Get <CharacterStateConfigManager>().AirMoveCurve;
                    curver.MovementCurve = SingletonManager.Get <CharacterStateConfigManager>().MovementCurve;
                    curver.PostureCurve  = SingletonManager.Get <CharacterStateConfigManager>().PostureCurve;
                    if (character.GetComponent <EntityReference>() == null)
                    {
                        character.AddComponentUncheckRequireAndDisallowMulti <EntityReference>();
                    }
                    character.GetComponent <EntityReference>().Init(player.entityAdapter);
                    var comp = character.AddComponent <PlayerVehicleCollision>();
                    comp.AllContext = _contexts;

                    var appearanceManager = new AppearanceManager();


                    var characterControllerManager = new CharacterControllerManager();
                    characterControllerManager.SetCharacterController(characterControllerContext);


                    var characterBone = new CharacterBoneManager();
                    characterBone.SetWardrobeController(appearanceManager.GetWardrobeController());
                    characterBone.SetWeaponController(appearanceManager.GetController <WeaponController>());
                    var weaponController = appearanceManager.GetController <WeaponController>() as WeaponController;
                    if (null != weaponController)
                    {
                        weaponController.SetWeaponChangedCallBack(characterBone.CurrentWeaponChanged);
                        weaponController.SetCacheChangeAction(characterBone.CacheChangeCacheAction);
                    }
                    player.AddCharacterControllerInterface(characterControllerManager);
                    player.AddAppearanceInterface(appearanceManager);
                    player.AddCharacterContoller(characterControllerContext);
                    player.AddCharacterBoneInterface(characterBone);
                    player.AddRecycleableAsset(character);
                    player.AddPlayerGameState(PlayerLifeStateEnum.NullState);
                }
            }
示例#28
0
        public void SetupLanguages()
        {
            lblanguages.Items.Clear();

            foreach (var lang in AppearanceManager.GetLanguages())
            {
                lblanguages.Items.Add(lang);
            }
        }
        /// <summary>
        /// Loads service objects into the ServiceContainer on startup of application.
        /// </summary>
        /// <returns>Returns the current <seealso cref="ServiceContainer"/> instance
        /// to let caller work with service container items right after creation.</returns>
        public static ServiceContainer InjectServices()
        {
            var appearance = AppearanceManager.GetInstance();

            ServiceContainer.Instance.AddService <ISettingsManager>(SettingsManager.GetInstance(appearance.CreateThemeInfos()));
            ServiceContainer.Instance.AddService <IAppearanceManager>(appearance);

            return(ServiceContainer.Instance);
        }
示例#30
0
        public void OpenFile(string file)
        {
            var contents = Objects.ShiftFS.Utils.ReadAllText(file);
            var dict     = JsonConvert.DeserializeObject <Dictionary <string, byte[]> >(contents);

            AppearanceManager.SetupWindow(this);
            Icons = dict;
            SetupUI();
        }
示例#31
0
 private void rtbchat_TextChanged(object sender, EventArgs e)
 {
     rtbchat.SelectionStart = rtbchat.Text.Length;
     rtbchat.ScrollToCaret();
     tschatid.Text = ChatID;
     AppearanceManager.SetWindowTitle(this, tschatid.Text + " - SimpleSRC Client");
     tsuserdata.Text = $"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}";
     RefreshUserInput();
 }
示例#32
0
        public void PopulateAppLauncher()
        {
            appsmenu.Children.Clear();

            double biggestWidth = 0;

            appsmenu.Background = LoadedSkin.Menu_ToolStripDropDownBackground.CreateBrush();

            foreach (var kv in AppLauncherDaemon.Available())
            {
                var item = new Button();
                if (kv.LaunchType.BaseType == typeof(System.Windows.Forms.UserControl))
                {
                    item.Content = kv.DisplayData.Name + " (Legacy)";
                }
                else
                {
                    item.Content = kv.DisplayData.Name;
                }
                item.Margin = new Thickness(2);
                double measure = item.Content.ToString().Measure(LoadedSkin.MainFont);
                if (measure > biggestWidth)
                {
                    biggestWidth = measure;
                }
                item.Click += (o, a) =>
                {
                    AppearanceManager.SetupWindow(Activator.CreateInstance(kv.LaunchType) as IShiftOSWindow);
                    appsmenu.Visibility = Visibility.Hidden;
                };
                item.HorizontalAlignment = HorizontalAlignment.Stretch;
                appsmenu.Children.Add(item);
            }

            if (Shiftorium.UpgradeInstalled("al_shutdown"))
            {
                var item = new Button();
                item.Content = ShiftOS.Engine.Localization.Parse("{SHUTDOWN}");
                item.Margin  = new Thickness(2);
                double measure = item.Content.ToString().Measure(LoadedSkin.MainFont);
                if (measure > biggestWidth)
                {
                    biggestWidth = measure;
                }


                item.Click += (o, a) =>
                {
                    TerminalBackend.InvokeCommand("sos.shutdown");
                };
                appsmenu.Children.Add(item);
            }

            appsmenu.Width = biggestWidth + 50;

            SkinAppLauncher();
        }
示例#33
0
        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="client">Reference to the GridClient object</param>
        /// <param name="bakeType"></param>
        /// <param name="textureCount">Total number of layers this layer set is
        /// composed of</param>
        /// <param name="paramValues">Appearance parameters the drive the 
        /// baking process</param>
        public Baker(LoggerInstance log, AppearanceManager.BakeType bakeType, int textureCount, Dictionary<int, float> paramValues)
        {
            _log = log;
            _bakeType = bakeType;
            _textureCount = textureCount;

            if (bakeType == AppearanceManager.BakeType.Eyes)
            {
                _bakeWidth = 128;
                _bakeHeight = 128;
            }
            else
            {
                _bakeWidth = 512;
                _bakeHeight = 512;
            }

            _paramValues = paramValues;

            if (textureCount == 0)
                Bake();
        }
示例#34
0
        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="client">Reference to the GridClient object</param>
        /// <param name="bakeType"></param>
        /// <param name="textureCount">Total number of layers this layer set is
        /// composed of</param>
        /// <param name="paramValues">Appearance parameters the drive the 
        /// baking process</param>
        public Baker(GridClient client, AppearanceManager.BakeType bakeType, int textureCount, Dictionary<int, float> paramValues)
        {
            _client = client;
            _bakeType = bakeType;
            _textureCount = textureCount;

            if (bakeType == AppearanceManager.BakeType.Eyes)
            {
                _bakeWidth = 128;
                _bakeHeight = 128;
            }
            else
            {
                _bakeWidth = 512;
                _bakeHeight = 512;
            }

            _paramValues = paramValues;

            if (textureCount == 0)
                Bake();
        }
示例#35
0
        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="client">Reference to the SecondLife client</param>
        /// <param name="totalLayers">Total number of layers this layer set is
        /// composed of</param>
        /// <param name="paramValues">Appearance parameters the drive the 
        /// baking process</param>
        /// <param name="width">Width of the final baked image</param>
        /// <param name="height">Height of the final baked image</param>
        public Baker(SecondLife client, AppearanceManager.BakeType bakeType, int textureCount, Dictionary<int, float> paramValues)
        {
            Client = client;
            BakeType = bakeType;
            TextureCount = textureCount;

            if (bakeType == AppearanceManager.BakeType.Eyes)
            {
                BakeWidth = 128;
                BakeHeight = 128;
            }
            else
            {
                BakeWidth = 512;
                BakeHeight = 512;
            }

            ParamValues = paramValues;

            if (textureCount == 0)
                Bake();
        }
示例#36
0
        private bool DrawLayer(AppearanceManager.TextureIndex textureIndex)
        {
            AssetTexture texture;
            bool useSourceAlpha = 
                (textureIndex == AppearanceManager.TextureIndex.HeadBodypaint ||
                textureIndex == AppearanceManager.TextureIndex.Skirt);

            if (_textures.TryGetValue(textureIndex, out texture))
                return DrawLayer(texture.Image, useSourceAlpha);
            else
                return false;
        }
示例#37
0
        /// <summary>
        /// Adds an image to this baking texture and potentially processes it, or
        /// stores it for processing later
        /// </summary>
        /// <param name="index">The baking texture index of the image to be added</param>
        /// <param name="texture">JPEG2000 compressed image to be added to the 
        /// baking texture</param>
        /// <returns>True if this texture is completely baked and JPEG2000 data 
        /// is available, otherwise false</returns>
        public bool AddTexture(AppearanceManager.TextureIndex index, AssetTexture texture)
        {
            lock (Textures)
            {
                try 
                {

                    texture.Decode();
                    Textures.Add(index, texture);
                    Client.DebugLog("Adding texture " + index.ToString() + " ID: " + texture.AssetID.ToString() + " to bake " + BakeType.ToString());
                }
                catch ( Exception e )
                {
                    Client.DebugLog( "caught exception while trying add texture: " + e.Message.ToString());
                }

            }

            if (Textures.Count == TextureCount)
            {
                Bake();
                
                return true;
            }
            else
                return false;
        }
示例#38
0
        /// <summary>
        /// Adds an image to this baking texture and potentially processes it, or
        /// stores it for processing later
        /// </summary>
        /// <param name="index">The baking texture index of the image to be added</param>
        /// <param name="jp2data">JPEG2000 compressed image to be added to the 
        /// baking texture</param>
        /// <returns>True if this texture is completely baked and JPEG2000 data 
        /// is available, otherwise false</returns>
        public bool AddTexture(AppearanceManager.TextureIndex index, byte[] jp2data)
        {
            lock (EncodedTextures)
            {
                EncodedTextures.Add(index, jp2data);
                Client.DebugLog("Adding texture " + index.ToString() + " to bake " + BakeType.ToString());
            }

            if (EncodedTextures.Count == TextureCount)
            {
                Bake();
                return true;
            }
            else
                return false;
        }
示例#39
0
 /// <summary>
 /// Adds layer for baking
 /// </summary>
 /// <param name="tdata">TexturaData struct that contains texture and its params</param>
 public void AddTexture(AppearanceManager.TextureData tdata)
 {
     lock (textures)
     {
         textures.Add(tdata);
     }
 }
示例#40
0
        public static AppearanceManager.BakeType BakeTypeFor(AppearanceManager.TextureIndex index)
        {
            switch (index)
            {
                case AppearanceManager.TextureIndex.HeadBodypaint:
                    return AppearanceManager.BakeType.Head;

                case AppearanceManager.TextureIndex.UpperBodypaint:
                case AppearanceManager.TextureIndex.UpperGloves:
                case AppearanceManager.TextureIndex.UpperUndershirt:
                case AppearanceManager.TextureIndex.UpperShirt:
                case AppearanceManager.TextureIndex.UpperJacket:
                    return AppearanceManager.BakeType.UpperBody;

                case AppearanceManager.TextureIndex.LowerBodypaint:
                case AppearanceManager.TextureIndex.LowerUnderpants:
                case AppearanceManager.TextureIndex.LowerSocks:
                case AppearanceManager.TextureIndex.LowerShoes:
                case AppearanceManager.TextureIndex.LowerPants:
                case AppearanceManager.TextureIndex.LowerJacket:
                    return AppearanceManager.BakeType.LowerBody;

                case AppearanceManager.TextureIndex.EyesIris:
                    return AppearanceManager.BakeType.Eyes;

                case AppearanceManager.TextureIndex.Skirt:
                    return AppearanceManager.BakeType.Skirt;

                default:
                    return AppearanceManager.BakeType.Unknown;
            }
        }
示例#41
0
        private bool DrawLayer(AppearanceManager.TextureIndex textureIndex)
        {
            int i = 0;

            AssetTexture texture = new AssetTexture();

            if ( ! Textures.TryGetValue(textureIndex, out texture))
                return false;

            Client.DebugLog("DrawLayer(): baking layer " + textureIndex.ToString());

            Image source = texture.Image;

            source.ResizeNearestNeighbor(BakeWidth, BakeHeight);

            if (textureIndex == AppearanceManager.TextureIndex.HeadBodypaint
                || textureIndex == AppearanceManager.TextureIndex.UpperBodypaint
                || textureIndex == AppearanceManager.TextureIndex.LowerBodypaint
                || textureIndex == AppearanceManager.TextureIndex.Skirt
                || textureIndex == AppearanceManager.TextureIndex.EyesIris)
            { // initial layer, just copy onto baked layer

                for (int y = 0; y < BakeHeight; y++)
                {
                    for (int x = 0; x < BakeWidth; x++)
                    {
                        if ((source.Channels & ImageChannels.Alpha) != 0)
                        {
                            if (source.Alpha[i] != 0)
                            {
                                BakedTexture.Image.Red[i] = source.Red[i];
                                BakedTexture.Image.Green[i] = source.Green[i];
                                BakedTexture.Image.Blue[i] = source.Blue[i];

                                BakedTexture.Image.Alpha[i] = source.Alpha[i];
                                BakedTexture.Image.Bump[i] = 0;
                            }
                        }
                        else
                        {
                            BakedTexture.Image.Red[i] = source.Red[i];
                            BakedTexture.Image.Green[i] = source.Green[i];
                            BakedTexture.Image.Blue[i] = source.Blue[i];
                            BakedTexture.Image.Alpha[i] = 255;

                            BakedTexture.Image.Bump[i] = 0;
                        }

                        ++i;
                    }
                }
            }
            else // not skin layer, so composite with alpha blending
            {

                for (int y = 0; y < BakeHeight; y++)
                {
                    for (int x = 0; x < BakeWidth; x++)
                    {

                        float alpha = (float)source.Alpha[i];
                        alpha /= 255.0f;
                        float red = (float)source.Red[i];
                        float green = (float)source.Green[i];
                        float blue = (float)source.Blue[i];
                        red /= 255.0f;
                        green /= 255.0f;
                        blue /= 255.0f;

                        float currRed = (float)BakedTexture.Image.Red[i];
                        float currGreen = (float)BakedTexture.Image.Green[i];
                        float currBlue = (float)BakedTexture.Image.Blue[i];

                        currRed /= 255.0F;
                        currGreen /= 255.0F;
                        currBlue /= 255.0F;

                        BakedTexture.Image.Red[i] = (byte)(255.0f * ((currRed * (1.0 - alpha)) + (red * alpha)));

                        BakedTexture.Image.Green[i] = (byte)(255.0f * ((currGreen * (1.0 - alpha)) + (green * alpha)));
                        BakedTexture.Image.Blue[i] = (byte)(255.0f * ((currBlue * (1.0 - alpha)) + (blue * alpha)));

                        i++;
                    }
                }
            }
            return true;
        }
示例#42
0
        public bool MissingTexture(AppearanceManager.TextureIndex index)
        {
            Logger.DebugLog(String.Format("Missing texture {0} in bake {1}", index, _bakeType), _client);
            _textureCount--;

            if (_textures.Count >= _textureCount)
            {
                Bake();
                return true;
            }
            else
            {
                return false;
            }
        }
示例#43
0
        private bool DrawLayer(AppearanceManager.TextureIndex textureIndex)
        {
            AssetTexture texture;
            ManagedImage source;
            bool sourceHasAlpha;
            bool sourceHasBump;
            bool copySourceAlphaToBakedLayer;
            int i = 0;

            try
            {
                if (!_textures.TryGetValue(textureIndex, out texture))
                    return false;

                source = texture.Image;

                sourceHasAlpha = ((source.Channels & ManagedImage.ImageChannels.Alpha) != 0 && source.Alpha != null);
                sourceHasBump = ((source.Channels & ManagedImage.ImageChannels.Bump) != 0 && source.Bump != null);

                copySourceAlphaToBakedLayer = sourceHasAlpha && (
                    textureIndex == AppearanceManager.TextureIndex.HeadBodypaint ||
                    textureIndex == AppearanceManager.TextureIndex.Skirt
                );

                if (source.Width != _bakeWidth || source.Height != _bakeHeight)
                    source.ResizeNearestNeighbor(_bakeWidth, _bakeHeight);
            }
            catch { return false; }

            int alpha = 255;
            //int alphaInv = 255 - alpha;
            int alphaInv = 256 - alpha;

            byte[] bakedRed = _bakedTexture.Image.Red;
            byte[] bakedGreen = _bakedTexture.Image.Green;
            byte[] bakedBlue = _bakedTexture.Image.Blue;
            byte[] bakedAlpha = _bakedTexture.Image.Alpha;
            byte[] bakedBump = _bakedTexture.Image.Bump;

            byte[] sourceRed = source.Red;
            byte[] sourceGreen = source.Green;
            byte[] sourceBlue = source.Blue;
            byte[] sourceAlpha = null;
            byte[] sourceBump = null;

            if (sourceHasAlpha)
                sourceAlpha = source.Alpha;

            if (sourceHasBump)
                sourceBump = source.Bump;

            for (int y = 0; y < _bakeHeight; y++)
            {
                for (int x = 0; x < _bakeWidth; x++)
                {
                    if (sourceHasAlpha)
                    {
                        alpha = sourceAlpha[i];
                        //alphaInv = 255 - alpha;
                        alphaInv = 256 - alpha;
                    }

                    bakedRed[i] = (byte)((bakedRed[i] * alphaInv + sourceRed[i] * alpha) >> 8);
                    bakedGreen[i] = (byte)((bakedGreen[i] * alphaInv + sourceGreen[i] * alpha) >> 8);
                    bakedBlue[i] = (byte)((bakedBlue[i] * alphaInv + sourceBlue[i] * alpha) >> 8);

                    if (copySourceAlphaToBakedLayer)
                        bakedAlpha[i] = sourceAlpha[i];

                    if (sourceHasBump)
                        bakedBump[i] = sourceBump[i];

                    i++;

                }
            }

            return true;
        }
示例#44
0
        public bool MissingTexture(AppearanceManager.TextureIndex index)
        {
            Client.DebugLog("Missing texture " + index.ToString() + " in bake " + BakeType.ToString());
            TextureCount--;

            if (Textures.Count == TextureCount)
            {
                Bake();
                return true;
            }
            else
                return false;
        }
示例#45
0
        /// <summary>
        /// Adds an image to this baking texture and potentially processes it, or
        /// stores it for processing later
        /// </summary>
        /// <param name="index">The baking texture index of the image to be added</param>
        /// <param name="jp2data">JPEG2000 compressed image to be added to the 
        /// baking texture</param>
        /// <returns>True if this texture is completely baked and JPEG2000 data 
        /// is available, otherwise false</returns>
        public bool AddTexture(AppearanceManager.TextureIndex index, AssetTexture texture)
        {
            lock (Textures)
            {
                texture.Decode();
                Textures.Add(index, texture);
                Client.DebugLog("Adding texture " + index.ToString() + " to bake " + BakeType.ToString());
            }

            if (Textures.Count == TextureCount)
            {
                Bake();
                return true;
            }
            else
                return false;
        }
示例#46
0
        /// <summary>
        /// Adds an image to this baking texture and potentially processes it, or
        /// stores it for processing later
        /// </summary>
        /// <param name="index">The baking texture index of the image to be added</param>
        /// <param name="texture">JPEG2000 compressed image to be
        /// added to the baking texture</param>
        /// <param name="needsDecode">True if <code>Decode()</code> needs to be
        /// called for the texture, otherwise false</param>
        /// <returns>True if this texture is completely baked and JPEG2000 data 
        /// is available, otherwise false</returns>
        public bool AddTexture(AppearanceManager.TextureIndex index, AssetTexture texture, bool needsDecode)
        {
            lock (_textures)
            {
                if (needsDecode)
                {
                    try
                    {
                        texture.Decode();
                    }
                    catch (Exception e)
                    {
                        Logger.Log(String.Format("AddTexture({0}, {1})", index, texture.AssetID), Helpers.LogLevel.Error, e);
                        return false;
                    }
                }

                _textures.Add(index, texture);
                Logger.DebugLog(String.Format("Added texture {0} (ID: {1}) to bake {2}", index, texture.AssetID, _bakeType), _client);
            }

            if (_textures.Count >= _textureCount)
            {
                Bake();
                return true;
            }
            else
            {
                return false;
            }
        }