Skip to content

Instantly share code, notes, and snippets.

View Pudding124's full-sized avatar
🏠
Working from home

Ming-jen, Hsu Pudding124

🏠
Working from home
  • Trend Micro Inc.
  • Taiwan
View GitHub Profile
@NodeEntity
public class Person {
// neo4j節點編號
@GraphId
private Long id;
// 以下皆定義節點的屬性
private String name;
// 以下是根據不同的人建立不同的Node
Person otaku = new Person("宅男", "男", "喜歡宅在家裡面,不喜歡出門");
Person dreamGirl = new Person("正妹", "女", "喜歡戶外運動,熱衷打扮");
Person hunk = new Person("帥哥", "男", "喜歡社交,對於出門穿搭非常講究");
@RelationshipEntity(type = "CRUSH_ON")
public class Crush_On {
@GraphId
private Long relationshipId;
// 起始節點
@StartNode
Person personA;
// 終止節點
// 建立關係,將 otaku 指向 dreamGirl
otaku.addCrushOnRelationship(otaku,dreamGirl);
// 將每個相同 Relationship 集中存入到 ArrayList 中,因為一個 Node 可能會有多個關係
@Relationship(type="CRUSH_ON")
ArrayList<Crush_On> crush_Ons = new ArrayList<Crush_On>();
@Relationship(type="HATE")
ArrayList<Hate> hates = new ArrayList<Hate>();
@Relationship(type="LIKE")
ArrayList<Like> likes = new ArrayList<Like>();
public interface PersonRepository extends GraphRepository<Person>{}
public interface GraphRepository<T> extends Neo4jRepository<T, Long> {
<S extends T> S save(S s, int depth);
<S extends T> Iterable<S> save(Iterable<S> entities, int depth);
T findOne(Long id, int depth);
Iterable<T> findAll();
personRepository.save(otaku);
func checkerBoard(){ //產生出遊戲題目
//亂數
let shuffledDistribution = GKShuffledDistribution(lowestValue: 0, highestValue: imageName.count - 1)
var count = 0;
for i in 0...5{
let index1 = shuffledDistribution.nextInt()
let index2 = shuffledDistribution.nextInt()
let index3 = shuffledDistribution.nextInt()
let index4 = shuffledDistribution.nextInt()
AllCard[count].setBackgroundImage(UIImage(named: imageName[index1]), for: .normal)
// 控制連擊動畫
func AnimateAlpha(comboNumber : Int) {
self.combo.alpha = 1
if comboNumber > 0{
combo.text = String(comboNumber)+" COMBO"
}
UIView.animate(withDuration: 0.7, delay: 0, animations: {
self.combo.alpha -= 1
self.combo.transform = CGAffineTransform.identity
.translatedBy(x: -100, y: 0)