Skip to content

Instantly share code, notes, and snippets.

@dfkeenan
dfkeenan / Frob.csx
Last active March 15, 2016 04:25
ScriptCatalogue for MEF
#r "System.ComponentModel.Composition"
using System;
using System.ComponentModel.Composition;
[Export("Frob")]
public class Frob
{
public string Name { get; set; }
@dfkeenan
dfkeenan / WindowManager.cs
Created May 10, 2016 08:14
Xenko Window thingy
using SiliconStudio.Core.Mathematics;
using SiliconStudio.Xenko.Engine;
using SiliconStudio.Xenko.Graphics;
using SiliconStudio.Xenko.UI;
using SiliconStudio.Xenko.UI.Controls;
using SiliconStudio.Xenko.UI.Panels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@dfkeenan
dfkeenan / INotifyActionAvailabilityChanged.cs
Created June 24, 2016 00:34
Add the ability to update availability of ActionMessage to Caliburn.Micro
using Caliburn.Micro;
using System;
namespace Custom.Caliburn.Micro
{
public interface INotifyActionAvailabilityChanged
{
event EventHandler<ActionAvailabilityChangedEventArgs> AvailabilityChanged;
}
@dfkeenan
dfkeenan / EntityExtensions.cs
Created December 22, 2016 12:40
Xenko Entity Extensions
using System.Collections.Generic;
using SiliconStudio.Xenko.Engine;
namespace MyGame
{
public static class EntityExtensions
{
public static IEnumerable<T> GetComponentsInChildren<T>(this Entity entity) where T : EntityComponent
{
//depth first
@dfkeenan
dfkeenan / HowTo.md
Last active January 7, 2017 06:33
Xenko: How-To use Entity Framework + Sqlite (Windows)

How to use Entity Framework & Sqlite with Xenko

This is an example/how-to for using Entity Framework & Sqlite with Xenko

  1. Add EF references to the "project.json" file of the "MyGame.Game" portable library project. See attached.
  2. Restore NuGet packages.
  3. Add Nuget Packages "Microsoft.EntityFrameworkCore.Design" and "Microsoft.EntityFrameworkCore.Sqlite" to the "MyGame.Windows" project. (not sure why this is required, Asset Compiler errors otherwise).
  4. Create your own DbContext similar to example attached. The filename stuff is important.
  5. Create script to load your DbContext. See "MyDatabaseScript.cs".
  6. Add database file as a Raw Asset and mark as root so it is included in build.
@dfkeenan
dfkeenan / NextSceneScript.cs
Created January 12, 2017 11:42
Xenko: Transitions
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using PhysicsSample.Transitions.Rendering.Images;
using SiliconStudio.Core.Extensions;
using SiliconStudio.Core.Mathematics;
using SiliconStudio.Xenko.Engine;
using SiliconStudio.Xenko.Graphics;
using SiliconStudio.Xenko.Input;
@dfkeenan
dfkeenan / Git Cheat Sheet.md
Last active October 5, 2019 03:54
Git Cheat Sheet

Git Cheat Sheet

Update Repository From Upstream

Add the remote, call it "upstream":

git remote add upstream https://github.com/whoever/whatever.git

Fetch all the branches of that remote into remote-tracking branches, such as upstream/master:

Create Icon

  magick convert logo.png -define icon:auto-resize=64,48,32,16 logo.ico
@dfkeenan
dfkeenan / LazyContent.cs
Created March 2, 2019 08:24
LazyContent proof of concept
using System;
using System.Collections.Generic;
using System.Text;
using Xenko.Core;
using Xenko.Core.Annotations;
using Xenko.Core.Serialization;
using Xenko.Core.Serialization.Contents;
namespace MyGame
{
@dfkeenan
dfkeenan / Directory.Build.targets
Last active May 21, 2020 21:41
Xenko Move to Lib
<Project>
<UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Web\Microsoft.Web.Publishing.Tasks.dll" />
<Target Name="MoveLib" AfterTargets="AfterBuild">
<ItemGroup>
<LibFiles Include="$(OutDir)*.*" Exclude="$(OutDir)$(AssemblyName).*" />
</ItemGroup>
<Move SourceFiles="@(LibFiles)" DestinationFolder="$(OutDir)lib" />
<TransformXml Source="$(OutDir)$(AssemblyName).exe.config" Transform="$(MSBuildThisFileDirectory)\LibTransform.xml" Destination="$(OutDir)$(AssemblyName).exe.config" />
</Target>
</Project>