Skip to content

Commit

Permalink
Merge pull request #25 from Sparkiy/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
AleksandarDev committed Dec 31, 2014
2 parents 97d069a + a259a4a commit fce7740
Show file tree
Hide file tree
Showing 40 changed files with 550 additions and 142 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Sparkiy for Windows
_Sparkiy/sparkiy-client_
# Sparkiy
_[Sparkiy/sparkiy-client](https://github.com/Sparkiy/sparkiy-client)_

[![GratiPay Tips](https://img.shields.io/gratipay/sparkiy.svg?style=flat-square)](https://gratipay.com/sparkiy/)
[![Bountysource](https://www.bountysource.com/badge/team?team_id=54298&style=bounties_posted)](https://www.bountysource.com/teams/sparkiy-client/bounties?utm_source=sparkiy-client&utm_medium=shield&utm_campaign=bounties_posted)

## Overview
Bring your ideas to life. Make something everyone can play on their computer, tablet, phone and console.
Expand All @@ -12,6 +15,7 @@ Sparkiy is fully-featured platform for game and application development. Touch f
- Xbox One

## Project status

| | master | beta | development | edge |
| ------------- | ------ | ---- | ----------- | ---- |
| Windows | [![master build status](https://ci.appveyor.com/api/projects/status/gvxevc5yih5oodnn/branch/master?svg=true&pendingText=pending...&passingText=OK&failingText=failed)](https://ci.appveyor.com/project/AleksandarDev/sparkiy-client/branch/master) | [![beta build status](https://ci.appveyor.com/api/projects/status/gvxevc5yih5oodnn/branch/beta?svg=true&pendingText=pending...&passingText=OK&failingText=failed)](https://ci.appveyor.com/project/AleksandarDev/sparkiy-client/branch/beta) | [![development build status](https://ci.appveyor.com/api/projects/status/gvxevc5yih5oodnn/branch/development?svg=true&pendingText=pending...&passingText=OK&failingText=failed)](https://ci.appveyor.com/project/AleksandarDev/sparkiy-client/branch/development) | [![edge build status](https://ci.appveyor.com/api/projects/status/gvxevc5yih5oodnn/branch/edge?svg=true&pendingText=pending...&passingText=OK&failingText=failed)](https://ci.appveyor.com/project/AleksandarDev/sparkiy-client/branch/edge) |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using System.Threading.Tasks;
using GalaSoft.MvvmLight.Command;
using GalaSoft.MvvmLight.Views;
using Nito.AsyncEx;
using SparkiyClient.Common;
using SparkiyClient.UILogic.Models;
using SparkiyClient.UILogic.Services;

namespace SparkiyClient.UILogic.ViewModels
namespace SparkiyClient.UILogic.Windows.ViewModels
{
public interface ICreateProjectPageViewModel
{
Expand All @@ -30,6 +28,21 @@ public CreateProjectPageViewModel(IProjectService projectService, INavigationSer
this.projectService = projectService;

this.CreateProjectCommand = new RelayCommand(this.CreateProjectCommandExecuteAsync);

this.Project = new Project()
{
Files = NotifyTaskCompletion.Create(async () =>
{
return new ObservableCollection<CodeFile>()
{
new Script()
{
Name = "Entry",
Code = "function Created()\n\nend\n\nfunction Started()\n\nend\n\nfunction Draw()\n\nend\n\nfunction Touched(type, x, y)\n\nend\n\nfunction Stopped()\n\nend\n"
}
};
})
};
}


Expand All @@ -41,10 +54,17 @@ private async void CreateProjectCommandExecuteAsync()

public Project Project
{
get { return this.GetProperty<Project>(defaultValue: new Project()); }
get { return this.GetProperty<Project>(); }
set { this.SetProperty(value); }
}

public RelayCommand CreateProjectCommand { get; }
}

public sealed class CreateProjectPageViewModelDesignTime : CreateProjectPageViewModel
{
public CreateProjectPageViewModelDesignTime() : base(null, null)
{
}
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,47 @@
using SparkiyClient.Common;
using System.Threading.Tasks;
using SparkiyClient.Common;
using SparkiyClient.UILogic.Models;
using SparkiyClient.UILogic.Services;

namespace SparkiyClient.UILogic.ViewModels
namespace SparkiyClient.UILogic.Windows.ViewModels
{
public interface IDebugPageViewModel
{

void AssignProjectPlayEngineManager(IProjectPlayEngineManagement projectPlayEngineManagement);

void AssignProjectPlayStateManager(IProjectPlayStateManagment projectPlayStateManagment);

Task AssignProjectAsync(Project project);
}

public class DebugPageViewModel : ExtendedViewModel, IDebugPageViewModel
{
private IProjectPlayEngineManagement projectPlayEngineManager;
private IProjectPlayStateManagment projectPlayStateManager;
private Project project;



public void AssignProjectPlayEngineManager(IProjectPlayEngineManagement projectPlayEngineManager)
{
this.projectPlayEngineManager = projectPlayEngineManager;
}

public void AssignProjectPlayStateManager(IProjectPlayStateManagment projectPlayStateManager)
{
this.projectPlayStateManager = projectPlayStateManager;
}

public async Task AssignProjectAsync(Project project)
{
this.project = project;
this.projectPlayEngineManager.AssignProject(this.project);

this.projectPlayStateManager.PlayProject();
}
}

public sealed class DebugPageViewModelDesignTime : DebugPageViewModel
{

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using Windows.Storage.Pickers;
using Windows.UI.Xaml.Navigation;
Expand All @@ -16,7 +14,7 @@
using SparkiyClient.UILogic.Models;
using SparkiyClient.UILogic.Services;

namespace SparkiyClient.UILogic.ViewModels
namespace SparkiyClient.UILogic.Windows.ViewModels
{
public interface INewFileViewModel
{
Expand Down Expand Up @@ -159,7 +157,7 @@ private async void AddNewAssetCommandExecuteAsync()
foreach (var selectedFile in selectedFiles)
await this.projectService.ImportAsset(this.Project, selectedFile);

var img = new Image();
var img = new ImageAsset();

}

Expand Down Expand Up @@ -211,7 +209,7 @@ public INewFileViewModel NewFileViewModel
public RelayCommand PlayProjectCommand { get; }
}

public class EditPageViewModelDesignTime : EditPageViewModel
public sealed class EditPageViewModelDesignTime : EditPageViewModel
{
public EditPageViewModelDesignTime() : base(null, null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

namespace SparkiyClient.UILogic.Models
{
public class Image : AssetWithData<BitmapImage>
public class ImageAsset : AssetWithData<BitmapImage>
{
private static readonly ILogger Log = LogManagerFactory.DefaultLogManager.GetLogger<Image>();
private static readonly ILogger Log = LogManagerFactory.DefaultLogManager.GetLogger<ImageAsset>();

/// <summary>
/// Gets the data asynchronously from given path.
Expand All @@ -17,7 +17,7 @@ public class Image : AssetWithData<BitmapImage>
public override async Task GetDataAsync()
{
this.Data = new BitmapImage(new Uri(this.Path, UriKind.Absolute));
Log.Debug("Loaded Image \"{0}\"", this.Name);
Log.Debug("Loaded ImageAsset \"{0}\"", this.Name);
}
#pragma warning restore 1998
}
Expand Down
2 changes: 1 addition & 1 deletion SparkiyClient/SparkiyClient.UILogic/Models/Project.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public async Task LoadAsync(IProjectService projectService)
await file.GetCodeAsync();

// Load images
foreach (var image in this.Assets.Result.OfType<Image>())
foreach (var image in this.Assets.Result.OfType<ImageAsset>())
await image.GetDataAsync();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System.Threading.Tasks;
using SparkiyClient.UILogic.Models;
using SparkiyEngine.Bindings.Component.Engine;

namespace SparkiyClient.UILogic.Services
{
public interface IProjectPlayEngineManagement
{
void AssignProject(Project project);

IEngineBindings Engine { get; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
namespace SparkiyClient.UILogic.Services
{
public interface IProjectPlayStateManagment
{
void PlayProject();

void PauseProject();

void RestartProject();

void TakeScreenshot();


bool IsInitialized { get; }

bool IsPlaying { get; }

bool IsPause { get; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public async Task ImportAsset(Project project, StorageFile file)
private Asset ResolveAsset(StorageFile file)
{
if (file.ContentType == "image/png")
return new Image()
return new ImageAsset()
{
Name = file.DisplayName,
Path = file.Path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<Compile Include="Models\Asset.cs" />
<Compile Include="Models\AssetWithData.cs" />
<Compile Include="Models\Class.cs" />
<Compile Include="Models\Image.cs" />
<Compile Include="Models\ImageAsset.cs" />
<Compile Include="Models\ImageSources.cs" />
<Compile Include="Models\ImageReference.cs" />
<Compile Include="Models\Project.cs" />
Expand All @@ -70,6 +70,8 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Services\DialogCommand.cs" />
<Compile Include="Services\IAlertMessageService.cs" />
<Compile Include="Services\IProjectPlayEngineManagement.cs" />
<Compile Include="Services\IProjectPlayStateManagment.cs" />
<Compile Include="Services\IProjectService.cs" />
<Compile Include="Services\IStorageService.cs" />
<Compile Include="Services\ProjectService.cs" />
Expand Down Expand Up @@ -140,4 +142,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,9 @@ public class PlayPageViewModel : ExtendedViewModel, IPlayPageViewModel
{

}

public sealed class PlayPageViewModelDesignTime : PlayPageViewModel
{

}
}
4 changes: 3 additions & 1 deletion SparkiyClient/SparkiyClient/SparkiyClient.Shared/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
using MetroLog.Internal;
using Microsoft.Practices.ServiceLocation;
using SparkiyClient.Common;
using SparkiyClient.UILogic.Windows.ViewModels;
using SparkiyClient.Views;

namespace SparkiyClient
Expand Down Expand Up @@ -195,10 +196,11 @@ private void OnContainerRegistration(IUnityContainer container)

// Register instances
this.container.RegisterInstance<IUnityContainer>(this.container);

// Register services
this.container.RegisterType<IAlertMessageService, AlertMessageService>(new ContainerControlledLifetimeManager());
this.container.RegisterType<INavigationService, NavigationService>(new ContainerControlledLifetimeManager());
this.container.RegisterType<EngineProviderService, EngineProviderService>(new ContainerControlledLifetimeManager());
this.container.RegisterType<IStorageService, StorageService>(new ContainerControlledLifetimeManager());
this.container.RegisterType<IProjectService, ProjectService>(new ContainerControlledLifetimeManager());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ public sealed partial class CodeEditorControl : UserControl, ICodeEditor
{
public event EventHandler OnCodeChanged;

private const string DebugTemplate = "function Created()\n\t\nend\n\nfunction Started()\n\t\nend\n\nfunction Draw()\n\t\nend\n\nfunction Touched(state, x, y)\n\t\nend\n\nfunction Stopped()\n\t\nend\n";


public CodeEditorControl()
{
Expand All @@ -22,10 +20,6 @@ public CodeEditorControl()

private void OnLoaded(object sender, RoutedEventArgs routedEventArgs)
{
#if DEBUG
this.CodeEditor.Text = DebugTemplate;
#endif

this.CodeEditor.TextView.TextChanged += (o, args) =>
{
this.OnCodeChanged?.Invoke(this, null);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<UserControl
x:Class="SparkiyClient.Controls.PlayView.PlayViewControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:SparkiyClient.Controls.PlayView"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="400">

<Grid>
<SwapChainPanel x:Name="SwapChainPanel" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />
</Grid>
</UserControl>
Loading

0 comments on commit fce7740

Please sign in to comment.