package org.example.composite;
public abstract class Component {
public abstract void method1();
public abstract void method2();
protected void add(Component component){}
}
package org.example.composite;
public class Leaf extends Component{
@Override
public void method1() {
}
@Override
public void method2() {
}
}
package org.example.composite;
import java.util.ArrayList;
import java.util.List;
public class Composite extends Component{
private List<Component> ComponentList = new ArrayList<>();
@Override
public void method1() {
}
@Override
public void method2() {
}
@Override
public void add(Component component) {
ComponentList.add(component);
}
}
package org.example.composite;
public class Main {
public static void main(String[] args) {
Component parent1 = new Composite();
Component parent2 = new Composite();
Component leaf1 = new Leaf();
Component leaf2 = new Leaf();
parent2.add(leaf1);
parent2.add(leaf2);
parent1.add(parent2);
}
}
public class MapData
{
public Citydata[] citydata { get; set; }
}
public class Citydata
{
public int id { get; set; }
public string name { get; set; }
public int population { get; set; }
public int money { get; set; }
public Point point { get; set; }
public int[] link { get; set; }
}
public class Point
{
public int x { get; set; }
public int y { get; set; }
}
これでJsonの読み込みはできるはず。
private const string _filename = "hokkaido.json";
public static MapData Load()
{
string json;
using (var stream = new StreamReader(_filename, true))
{
json = stream.ReadToEnd();
}
return JsonConvert.DeserializeObject<MapData>(json);
}
そして、下地の北海道の描画。
public MainScene()
{
}
protected override void OnRegistered()
{
layer = new asd.Layer2D();
AddLayer(layer);
// 下地
var background = new asd.GeometryObject2D();
layer.AddObject(background);
var bgRect = new asd.RectangleShape();
bgRect.DrawingArea = new asd.RectF(0, 0, 1900, 1000);
background.Shape = bgRect;
var hokkaido = new asd.TextureObject2D();
hokkaido.Texture = asd.Engine.Graphics.CreateTexture2D("101.png");
hokkaido.Scale = new asd.Vector2DF(1.5f, 1.5f);
layer.AddObject(hokkaido);
pi@raspberrypi:~ $ irrecord --disable-namespace -f -d /dev/lirc1 --driver default ~/lircd.
conf
Using raw access on device /dev/lirc1
irrecord - application for recording IR-codes for usage with lirc
Copyright (C) 1998,1999 Christoph Bartelmus(lirc@bartelmus.de)
This program will record the signals from your remote control
and create a config file for lircd.
A proper config file for lircd is maybe the most vital part of this
package, so you should invest some time to create a working config
file. Although I put a good deal of effort in this program it is often
not possible to automatically recognize all features of a remote
control. Often short-comings of the receiver hardware make it nearly
impossible. If you have problems to create a config file READ THE
DOCUMENTATION at https://sf.net/p/lirc-remotes/wiki
If there already is a remote control of the same brand available at
http://sf.net/p/lirc-remotes you might want to try using such a
remote as a template. The config files already contains all
parameters of the protocol used by remotes of a certain brand and
knowing these parameters makes the job of this program much
easier. There are also template files for the most common protocols
available. Templates can be downloaded using irdb-get(1). You use a
template file by providing the path of the file as a command line
parameter.
Please take the time to finish the file as described in
https://sourceforge.net/p/lirc-remotes/wiki/Checklist/ an send it
to <lirc@bartelmus.de> so it can be made available to others.
Press RETURN to continue.
Checking for ambient light creating too much disturbances.
Please don't press any buttons, just wait a few seconds...
No significant noise (received 0 bytes)
Enter name of remote (only ascii, no spaces) :
Enter name of remote (only ascii, no spaces) :tv
Using tv.lircd.conf as output filename
Now start pressing buttons on your remote control.
It is very important that you press many different buttons randomly
and hold them down for approximately one second. Each button should
generate at least one dot but never more than ten dots of output.
Don't stop pressing buttons until two lines of dots (2x80) have
been generated.
Press RETURN now to start recording.
................................................................................
Please enter the name for the next button (press <ENTER> to finish recording)
channel1
Now hold down button "channel1".
Timeout (10 seconds), try again (29 retries left).
Now hold down button "channel1".
Please enter the name for the next button (press <ENTER> to finish recording)
Successfully written config file tv.lircd.conf
Press RETURN now to start recording.のところで、学習するボタンをひたすら押し続ける。
package org.example.bridge;
public abstract class Implementor {
public abstract void implMethodX();
public abstract void implMethodY();
}
package org.example.bridge;
public class concreteImplementorA extends Implementor{
@Override
public void implMethodX() {
}
@Override
public void implMethodY() {
}
}
package org.example.bridge;
public class concreteImplementorB extends Implementor{
@Override
public void implMethodX() {
}
@Override
public void implMethodY() {
}
}
package org.example.bridge;
public class Abstraction {
Implementor implementor;
public Abstraction(Implementor implementor)
{
this.implementor = implementor;
}
public void method1()
{
}
public void method2()
{
}
}
package org.example.bridge;
public class RefileAbstraction extends Abstraction{
public RefileAbstraction(Implementor implementor) {
super(implementor);
}
@Override
public void method1()
{
}
@Override
public void method2()
{
}
public void refineMethodA()
{
}
public void refineMethodB()
{
}
}
package org.example.bridge;
public class Main {
public static void main(String[] args)
{
RefileAbstraction refileAbstraction1 = new RefileAbstraction(new concreteImplementorA());
refileAbstraction1.method1();
refileAbstraction1.method2();
refileAbstraction1.refineMethodA();
refileAbstraction1.refineMethodB();
RefileAbstraction refileAbstraction2 = new RefileAbstraction(new concreteImplementorB());
refileAbstraction2.method1();
refileAbstraction2.method2();
refileAbstraction2.refineMethodA();
refileAbstraction2.refineMethodB();
}
}