コード例 #1
0
ファイル: Sea.cs プロジェクト: caocao/3di-viewer-rei
 public Sea(Viewer viewer, SceneNode _parentNode)
     : base(viewer, -1, _parentNode)
 {
     shaderDirectory = Util.ApplicationDataDirectory + @"\media\shaders\";
     modelDirectory = Util.ApplicationDataDirectory + @"\media\models\";
     textureDirectory = Util.ApplicationDataDirectory + @"\media\textures\";
 }
コード例 #2
0
 public DirectionalLight(Viewer viewer, SceneNode _parentNode, string _name)
     : base(viewer, -1)
 {
     parentNode = _parentNode;
     rotation = new Vector3D();
     name = _name;
 }
コード例 #3
0
ファイル: CacheManager.cs プロジェクト: caocao/3di-viewer-rei
        private int DEFAULT_CACHE_SIZE = 300; // MB

        #endregion Fields

        #region Constructors

        public CacheManager(Viewer _viewer, int _id)
            : base(_viewer, _id)
        {
            CacheMaxSize = DEFAULT_CACHE_SIZE;
            CachePath = OpenViewer.Util.AssetFolder;
            CacheAllDelete = DEFAULT_CACHE_ALL_DELETE;
        }
コード例 #4
0
ファイル: Viewer.cs プロジェクト: zenkovich/MassageSalon
 void Awake()
 {
     Instance = this;
     transform.position = currentRoom.transform.position;
     moveAgent = GetComponent<NavMeshAgent>();
     Move(currentRoom);
 }
コード例 #5
0
        public EffectManager(Viewer _viewer)
            : base(_viewer, -1)
        {
            fadeAlpha.OnEnd += AlphaEventHandler;

            for (int i = 0; i < voiceEffectTexture.Length; i++)
                voiceEffectTexture[i] = Reference.VideoDriver.GetTexture(Util.ApplicationDataDirectory + @"\media\textures\voice_level_" + i.ToString() + ".png");
        }
コード例 #6
0
ファイル: threading.cs プロジェクト: katnegermis/JCD2014
 static void ExecuteSequentially()
 {
     model = new Model();
     viewer = new Viewer();
     for (int i = 0; i < numSteps; i++) {
         viewer.Display(model.NextValue());
     }
 }
コード例 #7
0
 public static Viewer CreateViewer()
 {
     Viewer viewer = new Viewer();
     viewer.isActive = false;
     lock (m_added) {
         m_added.Add(viewer);
     }
     return viewer;
 }
コード例 #8
0
		public override bool select(Viewer viewer, Object parentElement, Object element) {
			if (element instanceof IFolder) {
				var folder = (IFolder)element;
				var projectManager = Environment.getProjectManager((IResource)element);
				if (projectManager != null) {
					return !folder.getFullPath().equals(folder.getProject().getFullPath().append(projectManager.Properties.OutputPath));
				}
			}
			return true;
		}
コード例 #9
0
ファイル: IrrManager.cs プロジェクト: foxracle/3di-viewer-rei
        public IrrManager(Viewer viewer, int _id)
            : base(viewer, _id)
        {
            ChangeWorkDirectory(Util.ModelFolder);
            asset_max_threads = Reference.Viewer.Config.Source.Configs["Startup"].GetInt("asset_max_threads", 1);
            asset_fetch_retry = Reference.Viewer.Config.Source.Configs["Startup"].GetInt("asset_fetch_retry", 2);

            requestingThreadPool = new SmartThreadPool(120 * 1000, asset_max_threads);
            requestingThreadPool.Start();
        }
コード例 #10
0
 public void testConvertScreenLocToGameLoc()
 {
     Viewer test = new Viewer(50, 50);
     int width = 20;
     int height = 20;
     Assert.AreEqual(0, test.convertScreenLocToGameLoc(0, 0).X, "Game X location  should be 0.");
     Assert.AreEqual(0, test.convertScreenLocToGameLoc(0, 0).Y, "Game Y location should be 0");
     Assert.AreEqual(20 / width, test.convertScreenLocToGameLoc(20, 20).X, "Game X location should be " + 20 / width);
     Assert.AreEqual(20 / height, test.convertScreenLocToGameLoc(20, 20).Y, "Game Y location should be " + 20 / height);
     Assert.AreEqual(300 / width, test.convertScreenLocToGameLoc(300, 100).X, "Game X location should be " + 300 / width);
     Assert.AreEqual(100 / height, test.convertScreenLocToGameLoc(300, 100).Y, "Game Y location should be " + 100 / height);
 }
コード例 #11
0
ファイル: OsgControl.cs プロジェクト: samuto/UnityOpenCV
 public OsgControl()
     : base()
 {
     if (!DesignMode)
      {
     _viewer = new Viewer();
     _gw = _viewer.setUpViewerAsEmbeddedInWindow(0, 0, Width, Height);
     _viewer.setCameraManipulator(new TrackballManipulator());
     _viewer.realize();
     InitializeContexts();
      }
 }
コード例 #12
0
 private void SendMessage(Viewer v)
 {
     for (int i = totalHeight - messageHeight; i > 0; i--)
         v.p.SendMessage("");
     for (int i = v.pos; i < v.pos + messageHeight; i++)
     {
         if (i < v.message.Length)
             v.p.SendMessage(v.message[i]);
         else
             v.p.SendMessage("");
     }
 }
コード例 #13
0
ファイル: ViewForm.cs プロジェクト: kuyon/siren
        /// <summary>
        /// �R���X�g���N�^
        /// </summary>
        public ViewForm()
        {
            InitializeComponent();

            myViewer = new Viewer();
            t = new term(myViewer);
            t.Visible = false;
            this.Controls.Add(t);

            m = new InteractiveMenuContext(this);

            initKeyEvent();
            initMouseEvent();
        }
コード例 #14
0
ファイル: AboutDialog.cs プロジェクト: kuyon/siren
 public AboutDialog()
 {
     //
     // Required for Windows Form Designer support
     //
     InitializeComponent();
     //
     // TODO: Add any constructor code after InitializeComponent call
     //
     Viewer t = new Viewer();
     t.InitOCCViewer();
     float version = t.GetOCCVersion();
     this.myVersion.Text=this.myVersion.Text+version;
 }
コード例 #15
0
ファイル: threading.cs プロジェクト: katnegermis/JCD2014
    static void ExecuteConcurrently()
    {
        model = new Model();
        viewer = new Viewer();
        // Free space
        Thread modelThread = new Thread(new ThreadStart(CalculateAll));
        modelThread.Start();

        Thread viewerThread = new Thread(new ThreadStart(DisplayAll));
        viewerThread.Start();

        modelThread.Join();
        viewerThread.Join();
        // End of free space
    }
コード例 #16
0
        public ExportToolStripButton(Viewer host)
            : base("Export")
        {
            this.host = host;

            Enabled = false;
            AttachHostEvents();

            AvailableExports = new Dictionary<string, ExportItem>();

            Image = ToolStripButtonImage;
            ImageTransparentColor = ToolStripButtonImage.GetPixel(0, 0);

            AddAllExports();

            this.DropDownOpening += OnDropDownOpening;
        }
コード例 #17
0
ファイル: Viewer.cs プロジェクト: wang10998588/qjsbunitynew
 void Awake()
 {
     // switching level won't destroy JSEngine
     // but we'd like to destroy manually
     if (JSEngine.inst != null)
     {
         Destroy(JSEngine.inst.gameObject);
     }
     if (Viewer.inst != null)
     {
         Destroy(gameObject);
     }
     else
     {
         inst = this;
         DontDestroyOnLoad(gameObject);
     }
 }
コード例 #18
0
ファイル: SoundManager.cs プロジェクト: caocao/3di-viewer-rei
        public SoundManager(Viewer _viewer)
            : base(_viewer, -1)
        {
            try
            {
                engine = new IrrKlang.ISoundEngine();

                if (engine == null)
                    Reference.Log.Debug("Constructor: Engine NULL");
            }
            catch (Exception e)
            {
                Reference.Log.Debug("Constructor: ERROR:" + e.Message);
                engine = null;
            }

            ChangeWorkDirectory(Util.SoundFolder);
        }
コード例 #19
0
        public ProtocolManager(Viewer viewer)
            : base(viewer, -1)
        {
            avatarConnection = new SLProtocol();
            avatarConnection.m_user.Settings.MULTIPLE_SIMS = true;
            avatarConnection.m_user.Settings.STORE_LAND_PATCHES = true;
            avatarConnection.m_user.Settings.PARCEL_TRACKING = false;

            // Event handlers
            // - grid
            avatarConnection.OnGridConnected += OnGridConnected;

            // - region
            avatarConnection.OnSimConnected += OnSimConnected;
            avatarConnection.OnLandPatch += OnLandPatch;
            avatarConnection.OnSimDisconnected += OnSimDisconnected;
            avatarConnection.OnTeleportFinished += OnTeleportFinished;
            avatarConnection.OnCurrentSimChanged += OnCurrentSimChanged;

            // - avatars
            avatarConnection.OnLogin += OnLogin;
            avatarConnection.OnNewAvatar += OnNewAvatar;
            avatarConnection.OnAvatarSitResponse += OnAvatarSitResponse;
            avatarConnection.OnAnimationUpdate += avatarConnection_OnAnimationUpdate;

            // - prims and assets
            avatarConnection.OnNewPrim += OnNewPrim_warning; // warning: libomv invokes OnNewPrim event both for new prims and updates to prims
            avatarConnection.OnObjectUpdated += OnObjectUpdated;
            avatarConnection.OnObjectDeleted += OnObjectDeleted;

            // - miscellanious
            avatarConnection.OnChat += OnChat;
            avatarConnection.OnIM += OnIM;
            avatarConnection.OnLoadURL += OnLoadURL;
            avatarConnection.OnRegisterLoginRespons += RegisterLoginResponseHandler;

            // - sound
            avatarConnection.OnAttachSound += OnAttachSound;

            Reference.Viewer.StateManager.OnChanged += new StateManager.ChangedListener(StateManager_OnChanged);
        }
コード例 #20
0
        public WindowViewerChat(MainWindow window, Viewer viewer)
        {
            // Set fields
            this.window = window;
            this.viewer = viewer;

            // Init Window and set datacontext to this
            // for databinding to the attached Viewer
            InitializeComponent();
            DataContext = this;

            // Init IrcMessage collection and enable sync between threads
            colViewerMessages = new ObservableCollection<IrcMessage>();
            BindingOperations.EnableCollectionSynchronization(colViewerMessages, colLock);

            // Rather than copying all messages just collect the selected viewers
            // messages to save system resources in case of huge global chat history.
            var viewerMessages = MainWindow.colChatMessages.Where(
                TwitchChatMessage => TwitchChatMessage.Author == viewer.UserName);
            foreach (IrcMessage message in viewerMessages)
            {
                colViewerMessages.Add(message);
            }

            // Set item source for the listView and apply filter
            listViewChat.ItemsSource = colViewerMessages;

            // TODO quick and dirty isFollowing / isSub test
            cbFollowing.IsChecked = viewer.isFollowing();
            cbSubscribed.IsChecked = viewer.isSubscribed();
            using (WebClient wc = new WebClient())
            {
                BitmapImage logo = new BitmapImage();
                logo.BeginInit();
                logo.StreamSource = wc.OpenRead(Utils.GetClient().GetMyChannel().Logo);
                logo.CacheOption = BitmapCacheOption.OnLoad;
                logo.EndInit();
                image.Source = logo;
            }
        }
コード例 #21
0
		public override bool select(Viewer viewer, Object parent, Object element) {
			if (element instanceof IFile) {
				var file = (IFile)element;
				if (!excludedFiles.contains(file)) {
					var extension = file.getFullPath().getFileExtension();
					return "jar".equals(extension) || "zip".equals(extension);
				}
			} else if (element instanceof IContainer) {
				if (!recursive) {
					return true;
				}
				if (element instanceof IProject && !((IProject)element).isOpen()) {
					return false;
				}
				foreach (var member in ((IContainer)element).members()) {
					if (select(viewer, parent, member)) {
						return true;
					}
				}
			}
			return false;
		}
コード例 #22
0
ファイル: DatabaseUtils.cs プロジェクト: ocgineer/OakBot
        /// <summary>
        /// Add new viewer to DBfile with specified Viewer.
        /// Does not check if viewer exists, make sure it doesn't prior calling.
        /// </summary>
        /// <param name="viewer">Viewer to be added</param>
        public static void AddViewer(Viewer viewer)
        {
            SQLiteConnection dbConnection = new SQLiteConnection(string.Format("Data Source={0}; Version=3", fileViewers));
            dbConnection.Open();

            SQLiteCommand sqlCmd = new SQLiteCommand(
                string.Format("INSERT INTO `Viewers` VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', '{9}')",
                    viewer.UserName,
                    viewer.Points,
                    viewer.Spent,
                    viewer.Watched.ToString(),
                    viewer.LastSeen.ToString("o"),
                    viewer.Raids,
                    viewer.Title,
                    viewer.regular.ToString(),
                    viewer.IGN,
                    viewer.DiscordID),
                dbConnection);
            sqlCmd.ExecuteNonQuery();

            dbConnection.Close();
        }
コード例 #23
0
ファイル: Utils.cs プロジェクト: ocgineer/OakBot
 /// <summary>
 /// Add the viewer as Viewer to the viewers collection.
 /// Creates a new Viewer and adds it to the database if needed.
 /// </summary>
 /// <param name="viewerName">Viewers Twitch username to add</param>
 public static void AddToViewersCol(string viewerName)
 {
     // First check if viewer is not already in the viewers list
     var isInViewList = MainWindow.colViewers.FirstOrDefault(x => x.UserName == viewerName);
     if (isInViewList == null)
     {
         // Check if viewer exists in database to refer to
         var isInDatabase = MainWindow.colDatabase.FirstOrDefault(x => x.UserName == viewerName);
         if (isInDatabase != null)
         { // is in database
             MainWindow.colViewers.Add(isInDatabase);
             DatabaseUtils.UpdateViewer(isInDatabase);
         }
         else
         { // is not in database
             Viewer newViewer = new Viewer(viewerName);
             MainWindow.colDatabase.Add(newViewer);
             MainWindow.colViewers.Add(newViewer);
             DatabaseUtils.AddViewer(newViewer);
         }
     }
 }
コード例 #24
0
ファイル: TcpIPServer.cs プロジェクト: Honsal/ChatServer
        private void RoomChatMsg(Viewer viewer, string chat)
        {
            try
            {
                foreach (Viewer v in Viewers)
                {
                    if (v?.RoomInfo?.PaneNumber == viewer?.RoomInfo?.PaneNumber)
                    {
                        byte[] chatBuf = UTF8.GetBytes(chat);

                        MemoryStream stream = new MemoryStream();

                        BinaryWriter writer = new BinaryWriter(stream);
                        writer.Write(UTF8.GetBytes(NET_CHAT_MESSAGE));
                        writer.Write(BitConverter.ToUInt32(IPAddress.Parse(viewer.IpAddr).GetAddressBytes(), 0));
                        writer.Write(viewer.PaneBytes.Length);
                        writer.Write(viewer.PaneBytes);

                        writer.Write(UTF8.GetBytes(viewer.Nick).Length);
                        writer.Write(UTF8.GetBytes(viewer.Nick));

                        writer.Write(chatBuf.Length);
                        writer.Write(chatBuf);

                        byte[] buffer = stream.ToArray();

                        SocketAsyncEventArgs args = new SocketAsyncEventArgs();
                        args.SetBuffer(buffer, 0, buffer.Length);
                        v.Socket.SendAsync(args);
                    }
                }
                logln($"{viewer.Nick}#{viewer.RoomInfo.RoomID}: {chat}", true);
            }
            catch (Exception e)
            {
                logln(e.ToString(), true);
            }
        }
コード例 #25
0
ファイル: BaseShader.cs プロジェクト: foxracle/3di-viewer-rei
 public BaseShader(Viewer viewer, int id, SceneNode _parentNode)
     : base(viewer, id)
 {
     parentNode = _parentNode;
 }
コード例 #26
0
 public ShaderManager(Viewer viewer)
     : base(viewer, -1)
 {
 }
コード例 #27
0
 /// TODO (CR Dec 2011): Build this functionality right into ImageViewerComponent?
 public static IImageViewer GetViewer(Viewer viewer)
 {
     return(ViewerAutomationTool.GetViewer(viewer.Identifier));
 }
コード例 #28
0
 internal void InvokeViewerAdded(Viewer viewer)
 {
     ViewerAdded?.Invoke(null, viewer);
 }
コード例 #29
0
 public SignalLightGlowMaterial(Viewer viewer)
     : base(viewer, null)
 {
     SceneryShader = Viewer.MaterialManager.SceneryShader;
     Texture = SharedTextureManager.Get(Viewer.GraphicsDevice, Path.Combine(Viewer.ContentPath, "SignalLightGlow.png"));
 }
コード例 #30
0
        public SignalShape(Viewer viewer, SignalObj mstsSignal, string path, WorldPosition position, ShapeFlags flags)
            : base(viewer, path, position, flags)
        {
#if DEBUG_SIGNAL_SHAPES
            Console.WriteLine("{0} signal {1}:", Location.ToString(), mstsSignal.UID);
            UID = mstsSignal.UID;
#endif
            var signalShape = Path.GetFileName(path).ToUpper();
            if (!viewer.SIGCFG.SignalShapes.ContainsKey(signalShape))
            {
                Trace.TraceWarning("{0} signal {1} has invalid shape {2}.", Location.ToString(), mstsSignal.UID, signalShape);
                return;
            }
            var mstsSignalShape = viewer.SIGCFG.SignalShapes[signalShape];
#if DEBUG_SIGNAL_SHAPES
            Console.WriteLine("  Shape={0} SubObjs={1,-2} {2}", Path.GetFileNameWithoutExtension(path).ToUpper(), mstsSignalShape.SignalSubObjs.Count, mstsSignalShape.Description);
#endif

            // The matrix names are used as the sub-object names. The sub-object visibility comes from
            // mstsSignal.SignalSubObj, which is mapped to names through mstsSignalShape.SignalSubObjs.
            var visibleMatrixNames = new bool[SharedShape.MatrixNames.Count];
            for (var i = 0; i < mstsSignalShape.SignalSubObjs.Count; i++)
                if ((((mstsSignal.SignalSubObj >> i) & 0x1) == 1) && (SharedShape.MatrixNames.Contains(mstsSignalShape.SignalSubObjs[i].MatrixName)))
                    visibleMatrixNames[SharedShape.MatrixNames.IndexOf(mstsSignalShape.SignalSubObjs[i].MatrixName)] = true;

            // All sub-objects except the one pointing to the first matrix (99.00% times it is the first one, but not always, see Protrain) are hidden by default.
            //For each other sub-object, look up its name in the hierarchy and use the visibility of that matrix. 
            SubObjVisible = new bool[SharedShape.LodControls[0].DistanceLevels[0].SubObjects.Length];
            SubObjVisible[0] = true;
            for (var i = 1; i < SharedShape.LodControls[0].DistanceLevels[0].SubObjects.Length; i++)
            {
                if (i == SharedShape.RootSubObjectIndex) SubObjVisible[i] = true;
                else
                {
                    var subObj =SharedShape.LodControls[0].DistanceLevels[0].SubObjects[i];
                    int minHiLevIndex = 0;
                    if (subObj.ShapePrimitives[0].Hierarchy[subObj.ShapePrimitives[0].HierarchyIndex] > 0)
                        // Search for ShapePrimitive with lowest Hierarchy Value and check visibility with it
                    {
                        var minHiLev = 999;
                        for (var j = 0; j < subObj.ShapePrimitives.Length; j++)
                        {
                            if (subObj.ShapePrimitives[0].Hierarchy[subObj.ShapePrimitives[j].HierarchyIndex] < minHiLev)
                            {
                                minHiLevIndex = j;
                                minHiLev = subObj.ShapePrimitives[0].Hierarchy[subObj.ShapePrimitives[j].HierarchyIndex];
                            }
                        }
                    }
                    SubObjVisible[i] = visibleMatrixNames[SharedShape.LodControls[0].DistanceLevels[0].SubObjects[i].ShapePrimitives[minHiLevIndex].HierarchyIndex];
                }
            }

#if DEBUG_SIGNAL_SHAPES
            for (var i = 0; i < mstsSignalShape.SignalSubObjs.Count; i++)
                Console.WriteLine("  SUBOBJ {1,-12} {0,-7} {2,3} {3,3} {4,2} {5,2} {6,-14} {8} ({7})", ((mstsSignal.SignalSubObj >> i) & 0x1) != 0 ? "VISIBLE" : "hidden", mstsSignalShape.SignalSubObjs[i].MatrixName, mstsSignalShape.SignalSubObjs[i].Optional ? "Opt" : "", mstsSignalShape.SignalSubObjs[i].Default ? "Def" : "", mstsSignalShape.SignalSubObjs[i].JunctionLink ? "JL" : "", mstsSignalShape.SignalSubObjs[i].BackFacing ? "BF" : "", mstsSignalShape.SignalSubObjs[i].SignalSubType == -1 ? "<none>" : MSTS.SignalShape.SignalSubObj.SignalSubTypes[mstsSignalShape.SignalSubObjs[i].SignalSubType], mstsSignalShape.SignalSubObjs[i].SignalSubSignalType, mstsSignalShape.SignalSubObjs[i].Description);
            for (var i = 0; i < SubObjVisible.Length; i++)
                Console.WriteLine("  SUBOBJ {0,-2} {1,-7}", i, SubObjVisible[i] ? "VISIBLE" : "hidden");
#endif

            if (mstsSignal.SignalUnits == null)
            {
                Trace.TraceWarning("{0} signal {1} has no SignalUnits.", Location.ToString(), mstsSignal.UID);
                return;
            }

            for (var i = 0; i < mstsSignal.SignalUnits.Units.Length; i++)
            {
#if DEBUG_SIGNAL_SHAPES
                Console.Write("  UNIT {0}: TrItem={1,-5} SubObj={2,-2}", i, mstsSignal.SignalUnits.Units[i].TrItem, mstsSignal.SignalUnits.Units[i].SubObj);
#endif
                // Find the simulation SignalObject for this shape.
                var signalAndHead = viewer.Simulator.Signals.FindByTrItem(mstsSignal.SignalUnits.Units[i].TrItem);
                if (!signalAndHead.HasValue)
                {
                    Trace.TraceWarning("Skipped {0} signal {1} unit {2} with invalid TrItem {3}", Location.ToString(), mstsSignal.UID, i, mstsSignal.SignalUnits.Units[i].TrItem);
                    continue;
                }
                // Get the signal sub-object for this unit (head).
                var mstsSignalSubObj = mstsSignalShape.SignalSubObjs[mstsSignal.SignalUnits.Units[i].SubObj];
                if (mstsSignalSubObj.SignalSubType != 1) // SIGNAL_HEAD
                {
                    Trace.TraceWarning("Skipped {0} signal {1} unit {2} with invalid SubObj {3}", Location.ToString(), mstsSignal.UID, i, mstsSignal.SignalUnits.Units[i].SubObj);
                    continue;
                }
                var mstsSignalItem = (SignalItem)(viewer.Simulator.TDB.TrackDB.TrItemTable[mstsSignal.SignalUnits.Units[i].TrItem]);
                try
                {
                    // Go create the shape head.
                    Heads.Add(new SignalShapeHead(viewer, this, i, signalAndHead.Value.Value, mstsSignalItem, mstsSignalSubObj));
                }
                catch (InvalidDataException error)
                {
                    Trace.TraceWarning(error.Message);
                }
#if DEBUG_SIGNAL_SHAPES
                Console.WriteLine();
#endif
            }
        }
コード例 #31
0
        public override void DoWindowContents(Rect inRect)
        {
            GameFont normal = Text.Font;

            Rect title = new Rect(10f, 0f, 300f, 26f);

            Text.Font = GameFont.Medium;
            Widgets.Label(title, "Viewer Tool");

            Text.Font = GameFont.Small;

            if (notificationFrames > 0)
            {
                title.width = 340f;
                title.x     = inRect.width - 340f;
                Widgets.Label(title, notification);

                notificationFrames--;
            }

            Rect leftHalf  = new Rect(10f, 38f, (inRect.width - 20f) / 2f, inRect.height - 40f);
            Rect rightHalf = new Rect(leftHalf);

            rightHalf.x = leftHalf.width + 10f;

            Rect coinAmountBox = new Rect(leftHalf.x, leftHalf.y, leftHalf.width, 28f);

            string coinBuffer = coinBoxAmount.ToString();

            Widgets.TextFieldNumericLabeled <int>(coinAmountBox, "Coins:", ref coinBoxAmount, ref coinBuffer);


            Rect smallBtn = new Rect(leftHalf.width / 2f, leftHalf.y + 38f, leftHalf.width / 2f, 28f);

            // left half
            if (Widgets.ButtonText(smallBtn, "Give All Coins"))
            {
                Viewers.GiveAllViewersCoins(coinBoxAmount);
                if (selectedViewer != null)
                {
                    viewersCoins    += coinBoxAmount;
                    viewerCoinBuffer = viewersCoins.ToString();
                    UpdateViewer();
                }

                CreateNotification("Gave all viewers " + coinBoxAmount + " coins.");
            }

            smallBtn.y += 38f;

            if (Widgets.ButtonText(smallBtn, "Take All Coins"))
            {
                Viewers.GiveAllViewersCoins(-(coinBoxAmount));
                if (selectedViewer != null)
                {
                    viewersCoins    -= coinBoxAmount;
                    viewerCoinBuffer = viewersCoins.ToString();
                    UpdateViewer();
                }

                CreateNotification("Took " + coinBoxAmount + " coins from every viewer.");
            }

            smallBtn.y += 38f;

            if (!setAllCoinsWarning && Widgets.ButtonText(smallBtn, "Set All Coins"))
            {
                setAllCoinsWarning = true;
            }

            if (setAllCoinsWarning && Widgets.ButtonText(smallBtn, "Are you sure?"))
            {
                Viewers.SetAllViewersCoins(coinBoxAmount);
                if (selectedViewer != null)
                {
                    viewersCoins     = coinBoxAmount;
                    viewerCoinBuffer = viewersCoins.ToString();
                    UpdateViewer();
                }

                CreateNotification("Set all viewers coins to " + coinBoxAmount);
                setAllCoinsWarning = false;
            }

            smallBtn.y += 38f;

            if (!resetAllCoinsWarning && Widgets.ButtonText(smallBtn, "Reset All Coins"))
            {
                resetAllCoinsWarning = true;
            }

            if (resetAllCoinsWarning && Widgets.ButtonText(smallBtn, "Are you sure?"))
            {
                Viewers.SetAllViewersCoins(ToolkitSettings.StartingBalance);
                if (selectedViewer != null)
                {
                    viewersCoins     = ToolkitSettings.StartingBalance;
                    viewerCoinBuffer = viewersCoins.ToString();
                    UpdateViewer();
                }

                CreateNotification("Set all viewers coins to " + ToolkitSettings.StartingBalance);
                resetAllCoinsWarning = false;
            }

            Rect karmaAmountBox = new Rect(coinAmountBox);

            karmaAmountBox.y = smallBtn.y + 38f;

            string karmaBuffer = karmaBoxAmount.ToString();

            Widgets.TextFieldNumericLabeled <int>(karmaAmountBox, "Karma %:", ref karmaBoxAmount, ref karmaBuffer);

            smallBtn.y = karmaAmountBox.y + 38f;

            if (Widgets.ButtonText(smallBtn, "Give All Karma"))
            {
                Viewers.GiveAllViewersKarma(karmaBoxAmount);
                if (selectedViewer != null)
                {
                    viewersKarma      = Math.Min(karmaBoxAmount + viewersKarma, ToolkitSettings.KarmaCap);
                    viewerKarmaBuffer = viewersKarma.ToString();
                    UpdateViewer();
                }

                CreateNotification("Gave all viewers " + karmaBoxAmount + " karma.");
            }

            smallBtn.y += 38f;

            if (Widgets.ButtonText(smallBtn, "Take All Karma"))
            {
                Viewers.TakeAllViewersKarma(karmaBoxAmount);
                if (selectedViewer != null)
                {
                    viewersKarma      = Math.Max(viewersKarma - karmaBoxAmount, 0);
                    viewerKarmaBuffer = viewersKarma.ToString();
                    UpdateViewer();
                }

                CreateNotification("Took " + karmaBoxAmount + "% karma from every viewer.");
            }

            smallBtn.y += 38f;

            if (!setAllKarmaWarning && Widgets.ButtonText(smallBtn, "Set All Karma"))
            {
                setAllKarmaWarning = true;
            }

            if (setAllKarmaWarning && Widgets.ButtonText(smallBtn, "Are you sure?"))
            {
                Viewers.SetAllViewersKarma(karmaBoxAmount);
                if (selectedViewer != null)
                {
                    viewersKarma      = karmaBoxAmount;
                    viewerKarmaBuffer = viewersKarma.ToString();
                    UpdateViewer();
                }

                CreateNotification("Set all viewers karma to " + karmaBoxAmount);
                setAllKarmaWarning = false;
            }

            smallBtn.y += 38f;

            if (!resetAllKarmaWarning && Widgets.ButtonText(smallBtn, "Reset All Karma"))
            {
                resetAllKarmaWarning = true;
            }

            if (resetAllKarmaWarning && Widgets.ButtonText(smallBtn, "Are you sure?"))
            {
                Viewers.SetAllViewersKarma(karmaBoxAmount);
                if (selectedViewer != null)
                {
                    viewersKarma      = ToolkitSettings.StartingKarma;
                    viewerKarmaBuffer = viewersKarma.ToString();
                    UpdateViewer();
                }

                CreateNotification("Set all viewers karma to " + ToolkitSettings.StartingKarma);
                resetAllKarmaWarning = false;
            }

            // right half
            Rect viewerLabel = new Rect(rightHalf.x + 100, rightHalf.y, rightHalf.width, 28f);

            if (selectedViewer != null)
            {
                if (viewersCoins != viewersCoinsCached)
                {
                    UpdateViewer();
                }

                string colorCode = Viewer.GetViewerColorCode(selectedViewer.username);
                Widgets.Label(viewerLabel, $"<b>Viewer:</b> <color=#{colorCode}>{selectedViewer.username}</color>");

                viewerLabel.y += 98f;

                if (Viewer.IsModerator(selectedViewer.username))
                {
                    Widgets.Label(viewerLabel, "<b><color=#008000>Moderator</color></b>");

                    viewerLabel.y += 38f;
                }

                viewerLabel.x = rightHalf.x + 10;

                Widgets.TextFieldNumericLabeled <int>(viewerLabel, "Coins:", ref viewersCoins, ref viewerCoinBuffer);

                viewerLabel.y += 38f;

                Widgets.TextFieldNumericLabeled <int>(viewerLabel, "Karma %:", ref viewersKarma, ref viewerKarmaBuffer);

                viewerLabel.y    += 38f;
                viewerLabel.width = viewerLabel.width / 2;
                viewerLabel.x     = rightHalf.x + (rightHalf.width / 2f);

                if (Widgets.ButtonText(viewerLabel, "Give Coins"))
                {
                    viewersCoins    += coinBoxAmount;
                    viewerCoinBuffer = viewersCoins.ToString();
                    UpdateViewer();
                }

                viewerLabel.y += 38f;

                if (Widgets.ButtonText(viewerLabel, "Take Coins"))
                {
                    viewersCoins    -= coinBoxAmount;
                    viewerCoinBuffer = viewersCoins.ToString();
                    UpdateViewer();
                }

                viewerLabel.y += 38f;

                if (Widgets.ButtonText(viewerLabel, "Set Coins"))
                {
                    viewersCoins     = coinBoxAmount;
                    viewerCoinBuffer = viewersCoins.ToString();
                    UpdateViewer();
                }

                viewerLabel.y += 38f;

                if (Widgets.ButtonText(viewerLabel, "Reset Coins"))
                {
                    viewersCoins     = ToolkitSettings.StartingBalance;
                    viewerCoinBuffer = viewersCoins.ToString();
                    UpdateViewer();
                }

                viewerLabel.y += 38f;

                if (Widgets.ButtonText(viewerLabel, "Make Moderator"))
                {
                    selectedViewer.SetAsModerator();
                }

                viewerLabel.y += 38f;

                if (Widgets.ButtonText(viewerLabel, "Remove Moderator"))
                {
                    selectedViewer.RemoveAsModerator();
                }
            }

            if (lastSearch != usernameSearch)
            {
                selectedViewer = null;
                FindViewers();
            }

            Rect viewerBar = new Rect(rightHalf.x, 70f, rightHalf.width, 28f);

            usernameSearch = Widgets.TextEntryLabeled(viewerBar, "Search:", usernameSearch);

            if (searchResults != null && searchResults.Count > 0)
            {
                Rect vwrBtn = new Rect((inRect.width - 20f) * 0.75f, viewerBar.y + 38f, rightHalf.width / 2f, 28f);

                foreach (Viewer viewer in searchResults)
                {
                    if (Widgets.ButtonText(vwrBtn, viewer.username))
                    {
                        SetViewer(viewer);
                    }
                    vwrBtn.y += 28f;
                }
            }

            Rect bottomBar = new Rect(10f, inRect.height - 78f, (inRect.width - 20f) / 2f, 28f);

            if (Widgets.ButtonText(bottomBar, "Give viewers coins by karma"))
            {
                selectedViewer = null;
                Viewers.AwardViewersCoins();
                CreateNotification("Gave all viewers coins based on their karma");
            }

            bottomBar.x += bottomBar.width + 5f;

            if (!resetAllViewersWarning && Widgets.ButtonText(bottomBar, "Reset All Viewers"))
            {
                resetAllViewersWarning = true;
            }

            if (resetAllViewersWarning && Widgets.ButtonText(bottomBar, "Are you sure?"))
            {
                selectedViewer = null;
                Viewers.ResetViewers();
                CreateNotification($"Reset all viewers to {ToolkitSettings.StartingBalance} coins and {ToolkitSettings.StartingKarma}% karma.");
                resetAllViewersWarning = false;
            }
        }
コード例 #32
0
 private void Copy_Executed(object sender, System.Windows.Input.ExecutedRoutedEventArgs e)
 {
     Viewer.Copy();
 }
コード例 #33
0
 private void SelectAll_Executed(object sender, System.Windows.Input.ExecutedRoutedEventArgs e)
 {
     Viewer.SelectAll();
 }
コード例 #34
0
 private void RefreshView()
 {
     _html = "<html>\n<head>\n<style>\n" + _css + "</style>\n</head>\n<body oncontextmenu='return true'>\n" + _renderedMarkdown + "</body>\n</html>";
     Viewer.LoadHtml(_html, "http://renderpage/");
 }
コード例 #35
0
        public async void OnImagePreviewCompleted(uint viewerId)
        {
            Viewer viewer = _viewerList.Get(viewerId);

            if (viewer != null && _api != null)
            {
                CurrentCult cult       = CurrentCult.Get();
                string      dateFormat = cult.DateFormat;
                _api.SetDateFormat(dateFormat);
                string timeFormat = cult.TimeFormat;
                _api.SetTimeFormat(timeFormat);

                RecordingLocation location = _api.GetRecordingLocation(viewerId);
                double            angle    = _api.GetYaw(viewerId);
                double            hFov     = _api.GetHFov(viewerId);
                Color             color    = _api.GetViewerBorderColor(viewerId);
                await viewer.SetAsync(location, angle, hFov, color);

                string imageId = viewer.ImageId;

                if (GlobeSpotterConfiguration.AddLayerWfs)
                {
                    await UpdateVectorLayerAsync();

                    MapView          mapView             = MapView.Active;
                    Map              map                 = mapView?.Map;
                    SpatialReference spatRef             = map?.SpatialReference;
                    Unit             unit                = spatRef?.Unit;
                    double           factor              = unit?.ConversionFactor ?? 1;
                    double           overlayDrawDistance = _constants.OverlayDrawDistance / factor;
                    _api.SetOverlayDrawDistance(viewerId, overlayDrawDistance);
                }

                if (_openNearest.Contains(imageId))
                {
                    double pitch = _api.GetPitch(viewerId);
                    double v     = 90 - pitch;
                    _api.SetDrawingLayerVisible(true);
                    _api.SetDrawingMode(DrawingMode.CROSS_HAIR);
                    double size = _constants.CrossCheckSize;

                    _api.SetMarkerSize(size + 1);
                    _api.SetMarkerColor(Color.Bisque);
                    _api.DrawMarkerAtHV(viewerId, angle, v);

                    _api.SetMarkerSize(size - 1);
                    _api.SetMarkerColor(Color.Black);
                    _api.DrawMarkerAtHV(viewerId, angle, v);

                    viewer.HasMarker = true;
                    _openNearest.Remove(imageId);
                }

                DockPaneGlobeSpotter globeSpotter = ((dynamic)DataContext);
                Point3D point3D = globeSpotter?.LookAt;

                if (point3D != null)
                {
                    _api.LookAtCoordinate(viewerId, point3D.x, point3D.y, point3D.z);
                    globeSpotter.LookAt = null;
                }
            }

            await MoveToLocationAsync(viewerId);
        }
コード例 #36
0
ファイル: Leader.cs プロジェクト: RockInMars/DXF-Viewer
 public Leader(Schematic parent, Viewer viewer)
     : base(parent, viewer)
 {
 }
コード例 #37
0
        protected void FilterTrigerred()
        {
            bool isUseActions = false;

            TwitchBotGlobalObjects.CheckAndAddOrEditUserIfNeed(this._message);
            Viewer curentUser = AssistantDb.Instance.Viewers.Get(Convert.ToInt32(_message.UserId));

            switch (this.MinIgnoreUserRang)
            {
            case TwitchRangs.Unfollower:
                isUseActions = true;
                break;

            case TwitchRangs.Follower:
            {
                if (!(curentUser.IsFollower || curentUser.IsSubscriber || curentUser.IsModerator || curentUser.IsBroadcaster))
                {
                    isUseActions = true;
                }
            }
            break;

            case TwitchRangs.Subscriber:
            {
                if (!(curentUser.IsSubscriber || curentUser.IsModerator || curentUser.IsBroadcaster))
                {
                    isUseActions = true;
                }
            }
            break;

            case TwitchRangs.Moderator:
            {
                if (!(curentUser.IsModerator || curentUser.IsBroadcaster))
                {
                    isUseActions = true;
                }
            }
            break;

            case TwitchRangs.Broadcaster:
            {
                if (!curentUser.IsBroadcaster)
                {
                    isUseActions = true;
                }
            }
            break;

            default:
                break;
            }

            if (isUseActions)
            {
                UserActionInFilter currentUser = this._userActionInFilters.FirstOrDefault(user => user.User.Username == this._message.Username);

                if (currentUser == null)
                {
                    var tmpUser = new UserActionInFilter()
                    {
                        User = this._message
                    };

                    currentUser = tmpUser;
                    _userActionInFilters.Add(currentUser);
                }
                ;

                currentUser.CountExecuting++;

                if (currentUser.CountExecuting >= CountingExecuteBeforeSanctions + 1)
                {
                    currentUser.CountWarning++;

                    if (currentUser.CountWarning == CountingExecuteBeforeTimeOut + 1)
                    {
                        TimeOutToUser();
                        _userActionInFilters.Remove(currentUser);
                    }
                    else
                    {
                        FilterResponce($"{this.WarningMessage} {CountingExecuteBeforeTimeOut - currentUser.CountWarning + 1}");
                    }
                }
            }
        }
コード例 #38
0
ファイル: Observer.cs プロジェクト: Fachidiot/Desgine_Pattern
 public void Attach(Viewer investor)
 {
     Debug.Log("새로운 Viewer 추가");
     StateViewers.Add(investor);
 }
コード例 #39
0
        public TransferPrimitive(Viewer viewer, float width, float height, WorldPosition position)
        {
            var center      = position.Location;
            var radius      = (float)Math.Sqrt(width * width + height * height) / 2;
            var minX        = (int)Math.Floor((center.X - radius) / 8);
            var maxX        = (int)Math.Ceiling((center.X + radius) / 8);
            var minZ        = (int)Math.Floor((center.Z - radius) / 8);
            var maxZ        = (int)Math.Ceiling((center.Z + radius) / 8);
            var xnaRotation = position.XNAMatrix;

            xnaRotation.Translation = Vector3.Zero;
            Matrix.Invert(ref xnaRotation, out xnaRotation);

            var verticies = new VertexPositionTexture[(maxX - minX + 1) * (maxZ - minZ + 1)];

            for (var x = 0; x <= maxX - minX; x++)
            {
                for (var z = 0; z <= maxZ - minZ; z++)
                {
                    var i = x * (maxZ - minZ + 1) + z;
                    verticies[i].Position.X = (x + minX) * 8 - center.X;
                    verticies[i].Position.Y = viewer.Tiles.LoadAndGetElevation(position.TileX, position.TileZ, (x + minX) * 8, (z + minZ) * 8, false) - center.Y;
                    verticies[i].Position.Z = -(z + minZ) * 8 + center.Z;

                    var tc = new Vector3(verticies[i].Position.X, 0, verticies[i].Position.Z);
                    tc = Vector3.Transform(tc, xnaRotation);
                    verticies[i].TextureCoordinate.X = tc.X / width + 0.5f;
                    verticies[i].TextureCoordinate.Y = tc.Z / height + 0.5f;
                }
            }

            var indicies = new short[(maxX - minX) * (maxZ - minZ) * 6];

            for (var x = 0; x < maxX - minX; x++)
            {
                for (var z = 0; z < maxZ - minZ; z++)
                {
                    // Condition must match TerrainPatch.GetIndexBuffer's condition.
                    if (((x + minX) & 1) == ((z + minZ) & 1))
                    {
                        indicies[(x * (maxZ - minZ) + z) * 6 + 0] = (short)((x + 0) * (maxZ - minZ + 1) + (z + 0));
                        indicies[(x * (maxZ - minZ) + z) * 6 + 1] = (short)((x + 1) * (maxZ - minZ + 1) + (z + 1));
                        indicies[(x * (maxZ - minZ) + z) * 6 + 2] = (short)((x + 1) * (maxZ - minZ + 1) + (z + 0));
                        indicies[(x * (maxZ - minZ) + z) * 6 + 3] = (short)((x + 0) * (maxZ - minZ + 1) + (z + 0));
                        indicies[(x * (maxZ - minZ) + z) * 6 + 4] = (short)((x + 0) * (maxZ - minZ + 1) + (z + 1));
                        indicies[(x * (maxZ - minZ) + z) * 6 + 5] = (short)((x + 1) * (maxZ - minZ + 1) + (z + 1));
                    }
                    else
                    {
                        indicies[(x * (maxZ - minZ) + z) * 6 + 0] = (short)((x + 0) * (maxZ - minZ + 1) + (z + 1));
                        indicies[(x * (maxZ - minZ) + z) * 6 + 1] = (short)((x + 1) * (maxZ - minZ + 1) + (z + 1));
                        indicies[(x * (maxZ - minZ) + z) * 6 + 2] = (short)((x + 1) * (maxZ - minZ + 1) + (z + 0));
                        indicies[(x * (maxZ - minZ) + z) * 6 + 3] = (short)((x + 0) * (maxZ - minZ + 1) + (z + 0));
                        indicies[(x * (maxZ - minZ) + z) * 6 + 4] = (short)((x + 0) * (maxZ - minZ + 1) + (z + 1));
                        indicies[(x * (maxZ - minZ) + z) * 6 + 5] = (short)((x + 1) * (maxZ - minZ + 1) + (z + 0));
                    }
                }
            }

            VertexBuffer = new VertexBuffer(viewer.GraphicsDevice, typeof(VertexPositionTexture), verticies.Length, BufferUsage.WriteOnly);
            VertexBuffer.SetData(verticies);

            IndexBuffer = new IndexBuffer(viewer.GraphicsDevice, typeof(short), indicies.Length, BufferUsage.WriteOnly);
            IndexBuffer.SetData(indicies);
            PrimitiveCount = indicies.Length / 3;
        }
コード例 #40
0
ファイル: Observer.cs プロジェクト: Fachidiot/Desgine_Pattern
 public void Detach(Viewer investor)
 {
     Debug.Log("기존 Viewer 삭제");
     StateViewers.Remove(investor);
 }
コード例 #41
0
 public SignalLightMaterial(Viewer viewer, string textureName)
     : base(viewer, textureName)
 {
     SceneryShader = Viewer.MaterialManager.SceneryShader;
     Texture = Viewer.TextureManager.Get(textureName, true);
 }
コード例 #42
0
        public void SendMouseButtonAction(int button, ButtonAction buttonAction, double percentX, double percentY, Viewer viewer)
        {
            try
            {
                var isPressed = buttonAction == ButtonAction.Down;
                // Browser buttons start at 0.  XTest starts at 1.
                var mouseButton = (uint)(button + 1);

                InitDisplay();
                SendMouseMove(percentX, percentY, viewer);
                LibXtst.XTestFakeButtonEvent(Display, mouseButton, isPressed, 0);
                LibX11.XSync(Display, false);
            }
            catch (Exception ex)
            {
                Logger.Write(ex);
            }
        }
コード例 #43
0
        /// <summary>
        /// Retrieve a formatted list <see cref="ListLabel"/>s to be displayed as an in-browser Track Monitor.
        /// </summary>
        /// <param name="viewer">The Viewer to read train data from.</param>
        /// <returns>A list of <see cref="ListLabel"/>s, one per row of the popup.</returns>
        public IEnumerable <ListLabel> MultiPlayerWindowList(Viewer viewer)
        {
            //Update data
            keyPressed = "";
            labels     = new List <ListLabel>();
            void AddLabel(ListLabel label)
            {
                CheckLabel(ref label);
            }

            void AddSeparator() => AddLabel(new ListLabel
            {
                FirstCol = "Sprtr",
            });

            labels.Clear();
            UpdateDataEnded = false;
            // First Block
            // Client and server may have a time difference.
            var time = FormatStrings.FormatTime(viewer.Simulator.ClockTime + (MultiPlayerManager.IsClient() ? MultiPlayerManager.Instance().serverTimeDifference : 0));

            AddLabel(new ListLabel
            {
                FirstCol = $"{CatalogManager.Catalog.GetString("Time")}: {time}",
                LastCol  = ""
            });

            // Separator
            AddSeparator();

            // MultiPlayer
            if (MultiPlayerManager.IsMultiPlayer())
            {
                string text = MultiPlayerManager.Instance().GetOnlineUsersInfo();
                string multiPlayerStatus = MultiPlayerManager.IsServer()
                    ? $"{CatalogManager.Catalog.GetString("Dispatcher")} ({MultiPlayerManager.Client.UserName})" : MultiPlayerManager.Instance().AmAider
                    ? CatalogManager.Catalog.GetString("Helper") : MultiPlayerManager.IsClient()
                    ? $"{CatalogManager.Catalog.GetString("Client")} ({MultiPlayerManager.Client.UserName})" : "";

                var status = $"{CatalogManager.Catalog.GetString("Status")}: {multiPlayerStatus}";

                AddLabel(new ListLabel
                {
                    FirstCol = status,
                    LastCol  = ""
                });

                AddLabel(new ListLabel());

                // Number of player and trains
                foreach (var t in text.Split('\t'))
                {
                    AddLabel(new ListLabel
                    {
                        FirstCol = $"{t}",
                        LastCol  = ""
                    });
                }
                AddLabel(new ListLabel());
            }
            else if (Simulator.Instance.Confirmer != null)
            {
                var status = $"{CatalogManager.Catalog.GetString("Status")}: {CatalogManager.Catalog.GetString("Connection to the server is lost, will play as single mode")}";
                AddLabel(new ListLabel
                {
                    FirstCol = status,
                    LastCol  = ""
                });

                AddLabel(new ListLabel());
            }

            AddLabel(new ListLabel());
            UpdateDataEnded = true;
            return(labels);
        }
 private void OnPreview(object sender, RoutedEventArgs e)
 {
     Viewer.Preview();
 }
コード例 #45
0
ファイル: WebServer.cs プロジェクト: wacampbell/openrails
 public ORTSApiController(Viewer viewer)
 {
     Viewer = viewer;
 }
コード例 #46
0
        public MSTSSteamLocomotiveViewer(Viewer viewer, MSTSSteamLocomotive car)
            : base(viewer, car)
        {
            // Now all the particle drawers have been setup, assign them textures based
            // on what emitters we know about.
            string steamTexture = viewer.Simulator.RouteFolder.ContentFolder.TextureFile("smokemain.ace");

            foreach (var emitter in ParticleDrawers)
            {
                if (emitter.Key.ToLowerInvariant() == "cylindersfx")
                {
                    Cylinders.AddRange(emitter.Value);
                }
                else if (emitter.Key.ToLowerInvariant() == "cylinders2fx")
                {
                    Cylinders2.AddRange(emitter.Value);
                    car.Cylinder2SteamEffects = true;
                }
                else if (emitter.Key.ToLowerInvariant() == "blowdownfx")
                {
                    Blowdown.AddRange(emitter.Value);
                }
                else if (emitter.Key.ToLowerInvariant() == "drainpipefx")        // Drainpipe was not used in MSTS, and has no control set up for it
                {
                    Drainpipe.AddRange(emitter.Value);
                }
                else if (emitter.Key.ToLowerInvariant() == "injectors1fx")
                {
                    Injectors1.AddRange(emitter.Value);
                }
                else if (emitter.Key.ToLowerInvariant() == "injectors2fx")
                {
                    Injectors2.AddRange(emitter.Value);
                }
                else if (emitter.Key.ToLowerInvariant() == "smallejectorfx")
                {
                    SmallEjector.AddRange(emitter.Value);
                }
                else if (emitter.Key.ToLowerInvariant() == "largeejectorfx")
                {
                    LargeEjector.AddRange(emitter.Value);
                }
                else if (emitter.Key.ToLowerInvariant() == "compressorfx")
                {
                    Compressor.AddRange(emitter.Value);
                }
                else if (emitter.Key.ToLowerInvariant() == "generatorfx")
                {
                    Generator.AddRange(emitter.Value);
                    car.GeneratorSteamEffects = true;
                }
                else if (emitter.Key.ToLowerInvariant() == "safetyvalvesfx")
                {
                    SafetyValves.AddRange(emitter.Value);
                }
                else if (emitter.Key.ToLowerInvariant() == "stackfx")
                {
                    Stack.AddRange(emitter.Value);
                }
                else if (emitter.Key.ToLowerInvariant() == "whistlefx")
                {
                    Whistle.AddRange(emitter.Value);
                }
                foreach (var drawer in emitter.Value)
                {
                    drawer.Initialize(steamTexture);
                }
            }
        }
コード例 #47
0
ファイル: ReportViewer.xaml.cs プロジェクト: p00037/WpfBase
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     Viewer.LoadDocument(this.viewModel.Report);
     Viewer.Zoom = -2;
 }
コード例 #48
0
ファイル: UserCommand.cs プロジェクト: ocgineer/OakBot
        public void ExecuteCommandDiscord(Message message)
        {
            Viewer viewer;
            try
            {
                viewer = MainWindow.colDatabase.FirstOrDefault(x => x.DiscordID == message.User.Id.ToString());
                MainWindow.popMsgBox(viewer.UserName);
            }
            catch (Exception)
            {
                viewer = new Viewer(message.User.Name);
            }
            if (viewer == null)
            {
                return;
            }

            if (CanExecute(viewer))
            {
                Match targetMatch = Regex.Match(message.Text, @"@(?<name>[a-zA-Z0-9_]{4,25})");
                string target = targetMatch.Groups["name"].Value;

                // Parse response line here
                // @user@ -> Display name of the user of the command

                // @followdate@ -> Command user's follow date
                // @followdatetime@ -> Command user's follow date and time

                // @game@ -> Channels current game
                // @title@ -> Channels current title

                string parsedResponse = Regex.Replace(response, @"@(?<item>\w+)@", m =>
                {
                    string[] split = Regex.Split(message.Text, @"\s+");

                    switch (m.Groups["item"].Value.ToLower())
                    {
                        case "user":
                            return viewer.UserName;

                        case "followdate":
                            return viewer.GetFollowDateTime("yyyy-MM-dd");

                        case "followdatetime":
                            return viewer.GetFollowDateTime("yyyy-MM-dd HH:mm");

                        case "game":
                            return Utils.GetClient().GetMyChannel().Game;

                        case "title":
                            return Utils.GetClient().GetMyChannel().Status;

                        case "var1":
                            if (split.Count() == 2)
                            {
                                var1 = split[1];
                                return var1;
                            }
                            return "";

                        default:
                            return "";
                    }
                });

                MainWindow.discord.GetServer(message.Server.Id).GetChannel(message.Channel.Id).SendMessage(parsedResponse.Trim());
            }
        }
コード例 #49
0
 public TerrainManager(Viewer viewer)
     : base(viewer, -1)
 {
 }
コード例 #50
0
 public TerrainViewer(Viewer viewer)
 {
     Viewer = viewer;
 }
コード例 #51
0
ファイル: TcpIPServer.cs プロジェクト: Honsal/ChatServer
        /// <summary>
        /// 연결 수립시
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ClientAccepted(object sender, SocketAsyncEventArgs e)
        {
            // 클라이언트 소켓 얻기
            logln("연결 요청 확인됨.", true);
            Socket clientSock = e.AcceptSocket;

            if (clientSock != null && clientSock is Socket)
            {
                // 소켓 데이터 설정
                logln("대상: " + clientSock.RemoteEndPoint.ToString(), true);
                SocketAsyncEventArgs recvE = new SocketAsyncEventArgs();

                // 소켓 데이터 초기화
                SocketData data = new SocketData();
                data.initData(1024);

                recvE.UserToken = data;
                recvE.SetBuffer(data.Data, 0, 1024);
                recvE.Completed += new EventHandler<SocketAsyncEventArgs>(ReceiveCompleted);
                clientSock.ReceiveAsync(recvE);

                // 뷰어 초기화
                Viewer viewer = new Viewer();
                viewer.Socket = clientSock;
                viewer.SocketData = data;
                Viewers.Add(viewer);
            }
            else
            {
                logln("연결을 수립하는 중 에러 발생\n" + e.ToString(), true, true);
            }

            // 다음 연결 수립 대기
            Socket server = sender as Socket;
            e.AcceptSocket = null;
            server.AcceptAsync(e);
        }
コード例 #52
0
ファイル: AcrobotEnv.cs プロジェクト: uzbekdev1/DeepRL
 public override void Dispose()
 {
     Viewer.Dispose();
     Viewer = null;
     base.Dispose();
 }
コード例 #53
0
        public override byte[] Render(string mode = "human")
        {
            float b;
            float t;
            float r;
            float l;
            var   screen_width  = 600;
            var   screen_height = 400;
            var   world_width   = x_threshold * 2;
            var   scale         = screen_width / world_width;
            var   carty         = 300;
            var   polewidth     = 10.0f;
            var   poleheight    = scale * (2 * length);
            var   cartwidth     = 50.0f;
            var   cartheight    = 30.0f;

            if (viewer == null)
            {
                lock (this) {
                    //to prevent double initalization.
                    if (viewer == null)
                    {
                        viewer = Viewer.Run(screen_width, screen_height, "cartpole-v1");
                    }
                }
            }

            //pole
            l = -polewidth / 2;
            r = polewidth / 2;
            t = poleheight - polewidth / 2;
            b = -polewidth / 2;
            var pole   = new RectangularPolygon(-polewidth / 2, carty - poleheight, polewidth, poleheight);
            var circle = new EllipsePolygon(0, carty - polewidth / 2, polewidth / 2);

            //cart
            l = -cartwidth / 2;
            r = cartwidth / 2;
            t = cartheight / 2;
            b = -cartheight / 2;
            var axleoffset = cartheight / 4.0;
            var cart       = new RectangularPolygon(-cartwidth / 2, carty - cartheight / 2, cartwidth, cartheight);
            var draw       = new List <(IPath, Rgba32)>();

            if (!Equals(state, null))
            {
                var center_x = (float)(state.GetDouble(0) * scale + screen_width / 2.0f);
                //no y cuz it doesnt change.
                var cbounds    = circle.Bounds;
                var pivotPoint = new PointF(cbounds.X + cbounds.Width / 2f, cbounds.Y + cbounds.Height / 2f);

                draw.Add((cart.Translate(center_x, 0), Rgba32.Black));
                draw.Add((pole.Transform(Matrix3x2.CreateRotation((float)-state.GetDouble(2), pivotPoint)).Translate(center_x, 0), new Rgba32(204, 153, 102)));
                draw.Add((circle.Translate(center_x, 0), Rgba32.Teal));
            }
            else
            {
                draw.Add((pole, Rgba32.Orange));
                draw.Add((cart, Rgba32.Black));
                draw.Add((circle, Rgba32.Teal));
            }

            var img = new Image <Rgba32>(screen_width, screen_height);

            //line
            img.Mutate(i => i.BackgroundColor(Rgba32.White));
            img.Mutate(i => i.BackgroundColor(Rgba32.White));
            img.Mutate(i => i.Fill(Rgba32.Black, new RectangularPolygon(new PointF(0, carty), new PointF(screen_width, carty + 1))));
            foreach (var(path, rgba32) in draw)
            {
                img.Mutate(i => i.Fill(rgba32, path));
            }

            viewer.Render(img);

            //todo if (mode == "rgb_array") {
            //todo     ImageConverter converter = new ImageConverter();
            //todo     return (byte[]) converter.ConvertTo(((ImageImage) canvas.GetImage()).Image, typeof(byte[]));
            //todo }

            return(null);
        }
コード例 #54
0
            public SignalShapeHead(Viewer viewer, SignalShape signalShape, int index, SignalHead signalHead,
                        Orts.Formats.Msts.SignalItem mstsSignalItem, Orts.Formats.Msts.SignalShape.SignalSubObj mstsSignalSubObj)
            {
                Viewer = viewer;
                SignalShape = signalShape;
#if DEBUG_SIGNAL_SHAPES
                Index = index;
#endif
                SignalHead = signalHead;
                for (int mindex = 0; mindex <= signalShape.SharedShape.MatrixNames.Count - 1; mindex++)
                {
                    string MatrixName = signalShape.SharedShape.MatrixNames[mindex];
                    if (String.Equals(MatrixName, mstsSignalSubObj.MatrixName))
                        MatrixIndices.Add(mindex);
                }


                if (!viewer.SIGCFG.SignalTypes.ContainsKey(mstsSignalSubObj.SignalSubSignalType))
                    return;

                var mstsSignalType = viewer.SIGCFG.SignalTypes[mstsSignalSubObj.SignalSubSignalType];

                if (SignalTypes.ContainsKey(mstsSignalType.Name))
                    SignalTypeData = SignalTypes[mstsSignalType.Name];
                else
                    SignalTypeData = SignalTypes[mstsSignalType.Name] = new SignalTypeData(viewer, mstsSignalType);

                if (SignalTypeData.Semaphore)
                {
                    // Check whether we have to correct the Semaphore position indexes following the strange rule of MSTS
                    // Such strange rule is that, if there are only two animation steps in the related .s file, MSTS behaves as follows:
                    // a SemaphorePos (2) in sigcfg.dat is executed as SemaphorePos (1)
                    // a SemaphorePos (1) in sigcfg.dat is executed as SemaphorePos (0)
                    // a SemaphorePos (0) in sigcfg.dat is executed as SemaphorePos (0)
                    // First we check if there are only two animation steps
                    if (signalShape.SharedShape.Animations != null && signalShape.SharedShape.Animations.Count != 0 && MatrixIndices.Count > 0 &&
                            signalShape.SharedShape.Animations[0].anim_nodes[MatrixIndices[0]].controllers.Count != 0 &&
                            signalShape.SharedShape.Animations[0].anim_nodes[MatrixIndices[0]].controllers[0].Count == 2)
                    {

                        // OK, now we check if maximum SemaphorePos is 2 (we won't correct if there are only SemaphorePos 1 and 0,
                        // because they would both be executed as SemaphorePos (0) accordingly to above law, therefore leading to a static semaphore)
                        float maxIndex = float.MinValue;
                        foreach (SignalAspectData drAsp in SignalTypeData.DrawAspects.Values)
                        {
                            if (drAsp.SemaphorePos > maxIndex) maxIndex = drAsp.SemaphorePos;
                        }
                        if (maxIndex == 2)
                        {
                            // in this case we modify the SemaphorePositions for compatibility with MSTS.
                            foreach (SignalAspectData drAsp in SignalTypeData.DrawAspects.Values)
                            {
                                switch ((int)drAsp.SemaphorePos)
                                {
                                    case 2:
                                        drAsp.SemaphorePos = 1;
                                        break;
                                    case 1:
                                        drAsp.SemaphorePos = 0;
                                        break;
                                    default:
                                        break;
                                }
                            }
                            if (!SignalTypeData.AreSemaphoresReindexed)
                            {
                                Trace.TraceInformation("Reindexing semaphore entries of signal type {0} for compatibility with MSTS", mstsSignalType.Name);
                                SignalTypeData.AreSemaphoresReindexed = true;
                            }
                        }
                    }

                    foreach (int mindex in MatrixIndices)
                    {
                        if (mindex == 0 && (signalShape.SharedShape.Animations == null || signalShape.SharedShape.Animations.Count == 0 ||
                            signalShape.SharedShape.Animations[0].anim_nodes[mindex].controllers.Count == 0))
                            continue;
                        AnimatedPart SemaphorePart = new AnimatedPart(signalShape);
                        SemaphorePart.AddMatrix(mindex);
                        SemaphoreParts.Add(SemaphorePart);
                    }

                    if (Viewer.Simulator.TRK.Tr_RouteFile.DefaultSignalSMS != null)
                    {
                        var soundPath = Viewer.Simulator.RoutePath + @"\\sound\\" + Viewer.Simulator.TRK.Tr_RouteFile.DefaultSignalSMS;
                        try
                        {
                            Sound = new SoundSource(Viewer, SignalShape.Location.WorldLocation, Events.Source.MSTSSignal, soundPath);
                            Viewer.SoundProcess.AddSoundSources(this, new List<SoundSourceBase>() { Sound });
                        }
                        catch (Exception error)
                        {
                            Trace.WriteLine(new FileLoadException(soundPath, error));
                        }
                    }
                }

#if DEBUG_SIGNAL_SHAPES
                Console.Write("  HEAD type={0,-8} lights={1,-2} sem={2}", SignalTypeData.Type, SignalTypeData.Lights.Count, SignalTypeData.Semaphore);
#endif
            }
コード例 #55
0
ファイル: Circle.cs プロジェクト: RockInMars/DXF-Viewer
 public Circle(Schematic drawing, Viewer topLevelViewer)
     : base(drawing, topLevelViewer)
 {
 }
コード例 #56
0
 public TerrainSharedDistantMountain(Viewer viewer, string terrainTexture)
     : base(viewer, terrainTexture, Helpers.IsSnow(viewer.Simulator) ? SharedMaterialManager.DefaultDMSnowTexture : SharedMaterialManager.MissingTexture)
 {
 }
コード例 #57
0
ファイル: UserCommand.cs プロジェクト: ocgineer/OakBot
        private bool CanExecute(Viewer viewer)
        {
            // Check if command user has PERMISSION to use the command
            if (true)
            {
                // Check if command is on GLOBAL COOLDOWN
                if (gCooldownSec == 0 || DateTime.Now.Subtract(lastUsed).TotalSeconds > gCooldownSec)
                {
                    // Add user key if not exists to prevent exceptions if key not exists
                    // and it saves us another check when setting new timestamp, as this
                    // will already make sure they key exists.
                    if (!dictLastUsed.ContainsKey(viewer.UserName))
                    {
                        dictLastUsed.Add(viewer.UserName, DateTime.MinValue);
                    }

                    // Check if command user is not USER COOLDOWN
                    if (uCooldownSec == 0 || DateTime.Now.Subtract(dictLastUsed[viewer.UserName]).TotalSeconds > uCooldownSec)
                    {
                        return true;
                    }
                }
            }

            return false;
        }
コード例 #58
0
ファイル: Circle.cs プロジェクト: RockInMars/DXF-Viewer
 public Circle(Schematic drawing, Viewer topLevelViewer, Point center, double radius)
     : base(drawing, topLevelViewer)
 {
     this.center = center;
     this.radius = radius;
 }
コード例 #59
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AjaxPro.Utility.RegisterTypeForAjax(typeof(EmailOperationService));

            IsAdmin = Viewer.IsAdmin() || WebItemSecurity.IsProductAdministrator(WebItemManager.PeopleProductID, Viewer.ID);
        }
コード例 #60
0
 public override int GetValue(Viewer viewer) => value;