Skip to content

Commit 44a5728

Browse files
committed
忘了
1 parent 7f90048 commit 44a5728

File tree

3 files changed

+28
-12
lines changed

3 files changed

+28
-12
lines changed

VPet-Mac/Base.lproj/Main.storyboard

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,15 @@
120120
</button>
121121
</subviews>
122122
</customView>
123-
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Sog-FZ-g1c">
124-
<rect key="frame" x="-7" y="133" width="314" height="32"/>
123+
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ukD-a3-v9P">
124+
<rect key="frame" x="107" y="133" width="88" height="32"/>
125125
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
126-
<buttonCell key="cell" type="push" title="" bezelStyle="rounded" alignment="center" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="W1z-ed-fCV">
126+
<buttonCell key="cell" type="push" title="一键爬行" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="cDG-C2-g0b">
127127
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
128128
<font key="font" metaFont="system"/>
129129
</buttonCell>
130130
<connections>
131-
<action selector="onButtonClicked:" target="XfG-lQ-9wD" id="aqc-m4-J0v"/>
131+
<action selector="onButtonClicked:" target="XfG-lQ-9wD" id="lal-XQ-kJW"/>
132132
</connections>
133133
</button>
134134
</subviews>

VPet-Mac/VPet-autoaction-move.swift

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,12 @@ class VPetAutoMoveHandler{
202202
func startAutoMove(){
203203
if(moveStarted){return;}
204204
moveStarted = true;
205+
self.VPET.autoActionHendler.autoActionStarted = true;
205206
generateMove();
206207
}
207208
func stopWindowMove(){
208209
moveStarted = false;
210+
self.VPET.autoActionHendler.autoActionStarted = false;
209211
//终止当前可能存在的动画的方法
210212
NSAnimationContext.runAnimationGroup({ (context) in
211213
context.duration = 0.0
@@ -217,8 +219,6 @@ class VPetAutoMoveHandler{
217219
}
218220
func stopAutoMove(){
219221
//被用户交互阻止。
220-
if(!moveStarted){return;}
221-
//TODO
222222
stopWindowMove();
223223
moveStarted = false;
224224
let pl = self.VPET.generatePlayListC(graphtype: .Move, modetype: self.VPET.VPetStatus, title: self.playingKeyword!)
@@ -276,7 +276,21 @@ class VPetAutoMoveHandler{
276276
func animateWindow(startPos:Vector,endPos:Vector,duration:CGFloat,direction:MoveDirections) {
277277
if(!moveStarted){return;}
278278
//动画播放
279-
playingKeyword = directionKeyword[direction]!.randomElement()!
279+
if direction == .WalkLeft{
280+
switch VPET.VPetStatus{
281+
case .Happy:playingKeyword = "walk.left.faster";break;
282+
default:playingKeyword = "walk.left"
283+
}
284+
}
285+
else if direction == .WalkRight{
286+
switch VPET.VPetStatus{
287+
case .Happy:playingKeyword = "walk.right.faster";break;
288+
default:playingKeyword = "walk.right"
289+
}
290+
}
291+
else{
292+
playingKeyword = directionKeyword[direction]!.randomElement()!
293+
}
280294
let pl = VPET.generatePlayListAB(graphtype: .Move, modetype: VPET.VPetStatus, title: playingKeyword!)
281295

282296
VPET.animeplayer.interruptAndSetPlayList(pl);
@@ -311,9 +325,10 @@ class VPetAutoMoveHandler{
311325
}
312326
self.VPET.VPetGraphTypeStack.removeLast();
313327

328+
//是否接着移动
314329
//多么优秀的抽签方式
315-
let iscontinue = [true,true,true,false,false].randomElement()!
316-
// let iscontinue = true;
330+
// let iscontinue = [true,true,true,false,false].randomElement()!
331+
let iscontinue = true;
317332
if(iscontinue){
318333
self.generateMove()
319334
}

VPet-Mac/ViewController.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class ViewController: NSViewController {
4545
func initButton(){
4646
for subv in self.view.subviews{
4747
if let button = subv as? NSButton{
48-
// if(button.title == ""){continue;}
48+
// if(button.title == "一键爬行"){continue;}
4949
button.isHidden = true
5050
}
5151
}
@@ -113,15 +113,16 @@ class ViewController: NSViewController {
113113
VPET.workAndSleepHandler.endplayFromCurrentActionTitle();
114114
VPET.updateAnimation();
115115
}
116-
if(sender.title == ""){
116+
if(sender.title == "一键爬行"){
117117
guard let windowController = self.view.window?.windowController as? WindowController else{
118118
return;
119119
}
120120
guard let VPET = windowController.VPET else{
121121
return;
122122
}
123-
VPET.autoActionHendler.movehandler!.generateMove()
123+
VPET.autoActionHendler.movehandler!.startAutoMove()
124124
}
125+
125126
}
126127

127128

0 commit comments

Comments
 (0)