- fix on-screen widget tool selectedWidgetView bug
- update & replace new widget template bin file
This commit is contained in:
@@ -13,7 +13,8 @@
|
||||
#import "OnScreenButtonState.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
#define DEFAULT_TEMPLATE_NAME @"高级控件模板(Advanced widget templates)"
|
||||
#define DEFAULT_TEMPLATE_NAME1 @"控件模板 / Widget templates"
|
||||
#define DEFAULT_TEMPLATE_NAME2 @"旧版屏显控件 / Legacy on-screen controls"
|
||||
|
||||
/**
|
||||
This object contains information pertaining to any of the user created, custom on screen controller layout configurations, or 'profiles.' The object contains a 'name' property for easy reference, as well as an 'isSelected' property which is used to determine whether this particular custom OSC layout should show on screen during game stream view. Only one 'OSCProfile' is set to 'isSelected' at any given time. The object also contains an array of 'OnScreenButtonStates' which provides information that allows us to move and hide/unhide each of the 19 on screen buttons. Note that the 'buttonStates' property should contain an NSMutableArray of ENCODED 'OnScreenButtonState' objects. This allows us to save the 'OSCProfile' object to NSUserDefaults.
|
||||
|
||||
@@ -68,7 +68,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
* Lets the caller of this method know whether a profile with a given name already exists in persistent storage
|
||||
*/
|
||||
- (BOOL) profileNameAlreadyExist:(NSString*)name;
|
||||
- (BOOL) profileName:(NSString*) name alreadyExistIn:(NSMutableArray*)profiles;
|
||||
- (OSCProfile *) findProfileByName:(NSString*) name inProfileArray:(NSMutableArray*)profiles;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -142,7 +142,11 @@ static CGRect streamViewBounds;
|
||||
|
||||
- (void) importEncodedProfiles:(NSMutableArray* )profilesEncoded {
|
||||
NSMutableArray* targetProfiles = [_currentProfiles mutableCopy]; //_currentProfiles is availabled as long as getAllProfiles was called before calling this method (_currentProfiles avoids frequent accessing persisted data)
|
||||
if([self profileName:DEFAULT_TEMPLATE_NAME alreadyExistIn:targetProfiles] && targetProfiles.count > 1) [targetProfiles removeObjectAtIndex:1];
|
||||
OSCProfile* profile;
|
||||
profile = [self findProfileByName:DEFAULT_TEMPLATE_NAME1 inProfileArray:targetProfiles];
|
||||
if(profile && targetProfiles.count > 1) [targetProfiles removeObject:profile];
|
||||
profile = [self findProfileByName:DEFAULT_TEMPLATE_NAME2 inProfileArray:targetProfiles];
|
||||
if(profile && targetProfiles.count > 1) [targetProfiles removeObject:profile];
|
||||
if(targetProfiles.count > 0) [targetProfiles removeObjectAtIndex:0];
|
||||
NSMutableArray* localEncodedPofiles = [self encodedProfilesFromArray:targetProfiles];
|
||||
[profilesEncoded addObjectsFromArray:localEncodedPofiles];
|
||||
@@ -393,14 +397,14 @@ static CGRect streamViewBounds;
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL) profileName:(NSString*) name alreadyExistIn:(NSMutableArray*)profiles {
|
||||
- (OSCProfile *) findProfileByName:(NSString*) name inProfileArray:(NSMutableArray*)profiles {
|
||||
/* Iterate through the decoded profiles and return 'YES' if one of the profiles' 'name' properties equals the 'name' passed into this method */
|
||||
for (OSCProfile *profile in profiles) {
|
||||
if ([profile.name isEqualToString:name]) {
|
||||
return YES;
|
||||
return profile;
|
||||
}
|
||||
}
|
||||
return NO;
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (OnScreenButtonState *)unarchiveButtonStateEncoded:(NSData *)data {
|
||||
|
||||
@@ -587,7 +587,7 @@ import UIKit
|
||||
// illustrate offset distance in edit mode
|
||||
// let offsetSign = self.selfViewOnTheRight ? -1 : 1 // dprecated
|
||||
// let illlustrationPoint = CGPointMake(CGRectGetMidX(self.frame), CGRectGetMaxY(self.frame)/4)
|
||||
self.crossMarkLayer.position = CGPointMake(CGRectGetMidX(self.stickBallLayer.frame), CGRectGetMidY(self.stickBallLayer.frame)-stickIndicatorOffset)
|
||||
self.stickBallLayer.position = CGPointMake(CGRectGetMidX(self.crossMarkLayer.frame), CGRectGetMidY(self.crossMarkLayer.frame)-stickIndicatorOffset)
|
||||
}
|
||||
CATransaction.commit()
|
||||
}
|
||||
|
||||
Binary file not shown.
+14
-14
@@ -81,9 +81,8 @@
|
||||
- (void) reloadOnScreenWidgetViews {
|
||||
NSLog(@"reloadOnScreenWidgets %f", CACurrentMediaTime());
|
||||
OnScreenWidgetView.editMode = true;
|
||||
[self->selectedWidgetView.stickBallLayer removeFromSuperlayer];
|
||||
[self->selectedWidgetView.crossMarkLayer removeFromSuperlayer];
|
||||
|
||||
[self clearStickIndicator];
|
||||
|
||||
for (UIView *subview in self.view.subviews) {
|
||||
if ([subview isKindOfClass:[OnScreenWidgetView class]]) {
|
||||
[subview removeFromSuperview];
|
||||
@@ -168,7 +167,7 @@
|
||||
[profilesManager saveProfileWithName:@"Default" andButtonLayers:self.layoutOSC.OSCButtonLayers];
|
||||
[profilesManager importDefaultTemplates];
|
||||
}*/
|
||||
if (![profilesManager profileName:DEFAULT_TEMPLATE_NAME alreadyExistIn:allProfiles]){
|
||||
if (![profilesManager findProfileByName:DEFAULT_TEMPLATE_NAME1 inProfileArray:allProfiles]){
|
||||
[profilesManager importDefaultTemplates];
|
||||
}
|
||||
|
||||
@@ -655,6 +654,11 @@
|
||||
label.numberOfLines = 1;
|
||||
}
|
||||
|
||||
- (void)clearStickIndicator{
|
||||
[self->selectedWidgetView.stickBallLayer removeFromSuperlayer];
|
||||
[self->selectedWidgetView.crossMarkLayer removeFromSuperlayer];
|
||||
}
|
||||
|
||||
- (void)widgetViewTapped: (NSNotification *)notification{
|
||||
//self.undoButton.alpha = selectedWidgetView.layoutChanges.count>1 && !CGPointEqualToPoint(selectedWidgetView.layoutChanges.lastObject.CGPointValue, selectedWidgetView.initialCenter)? 1.0 : 0.3;
|
||||
|
||||
@@ -663,8 +667,7 @@
|
||||
|
||||
OnScreenWidgetView* widgetView = (OnScreenWidgetView* )notification.object;
|
||||
|
||||
[self->selectedWidgetView.stickBallLayer removeFromSuperlayer];
|
||||
[self->selectedWidgetView.crossMarkLayer removeFromSuperlayer];
|
||||
[self clearStickIndicator];
|
||||
self->widgetViewSelected = true;
|
||||
self->controllerLayerSelected = false;
|
||||
self->selectedWidgetView = widgetView;
|
||||
@@ -705,8 +708,7 @@
|
||||
}
|
||||
if(showStickIndicatorOffsetStack){
|
||||
// illustrating the indicator offset,
|
||||
[selectedWidgetView.stickBallLayer removeFromSuperlayer];
|
||||
[selectedWidgetView.crossMarkLayer removeFromSuperlayer];
|
||||
[self clearStickIndicator];
|
||||
selectedWidgetView.touchBeganLocation = CGPointMake(CGRectGetWidth(selectedWidgetView.frame)/2, CGRectGetHeight(selectedWidgetView.frame)/4);
|
||||
[selectedWidgetView showStickIndicator];// this will create the indicator CAShapeLayers
|
||||
[self.stickIndicatorOffsetSlider setValue:self->selectedWidgetView.stickIndicatorOffset];
|
||||
@@ -743,8 +745,7 @@
|
||||
- (void)legacyOscLayerTapped: (NSNotification *)notification{
|
||||
[self enableCommonWidgetTools];
|
||||
CALayer* controllerLayer = (CALayer* )notification.object;
|
||||
[self->selectedWidgetView.stickBallLayer removeFromSuperlayer];
|
||||
[self->selectedWidgetView.crossMarkLayer removeFromSuperlayer];
|
||||
[self clearStickIndicator];
|
||||
self->widgetViewSelected = false;
|
||||
self->selectedWidgetView = nil;
|
||||
|
||||
@@ -1120,6 +1121,8 @@
|
||||
|
||||
- (void) presentProfilesTableView{
|
||||
[self saveTapped:nil];
|
||||
[self clearStickIndicator];
|
||||
selectedWidgetView = nil;
|
||||
UIStoryboard *storyboard;
|
||||
BOOL isIPhone = ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone);
|
||||
if (isIPhone) {
|
||||
@@ -1144,8 +1147,6 @@
|
||||
|
||||
self.widgetPanelStack.hidden = YES;
|
||||
|
||||
[self->selectedWidgetView.stickBallLayer removeFromSuperlayer];
|
||||
[self->selectedWidgetView.crossMarkLayer removeFromSuperlayer];
|
||||
_oscProfilesTableViewController.currentOSCButtonLayers = self.layoutOSC.OSCButtonLayers;
|
||||
|
||||
[self presentViewController:_oscProfilesTableViewController animated:YES completion:nil];
|
||||
@@ -1252,8 +1253,7 @@
|
||||
if(!isToolbarHidden && self->selectedWidgetView != nil && [self layerIsOverlappingWithTrashcanButton:selectedWidgetView.layer]){
|
||||
[self->selectedWidgetView removeFromSuperview];
|
||||
[self.OnScreenWidgetViews removeObject:self->selectedWidgetView];
|
||||
[selectedWidgetView.stickBallLayer removeFromSuperlayer];
|
||||
[selectedWidgetView.crossMarkLayer removeFromSuperlayer];
|
||||
[self clearStickIndicator];
|
||||
[selectedWidgetView.buttonDownVisualEffectLayer removeFromSuperlayer];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user