save
|
|
@ -7,7 +7,6 @@ temp/
|
|||
local/
|
||||
build/
|
||||
profiles/
|
||||
native
|
||||
#//////////////////////////
|
||||
# NPM
|
||||
#//////////////////////////
|
||||
|
|
|
|||
|
|
@ -0,0 +1,47 @@
|
|||
enable_language(C ASM)
|
||||
set(DEVELOPMENT_TEAM "" CACHE STRING "APPLE Developtment Team")
|
||||
set(RES_DIR "" CACHE STRING "Resource path")
|
||||
set(COCOS_X_PATH "" CACHE STRING "Path to engine/native/")
|
||||
|
||||
set(TARGET_OSX_VERSION "10.14" CACHE STRING "Target MacOSX version" FORCE)
|
||||
set(TARGET_IOS_VERSION "11.0" CACHE STRING "Target iOS version" FORCE)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
option(CC_DEBUG_FORCE "Force enable CC_DEBUG in release mode" OFF)
|
||||
option(USE_SE_V8 "Use V8 JavaScript Engine" ON)
|
||||
option(USE_V8_DEBUGGER "Compile v8 inspector ws server" ON)
|
||||
option(USE_V8_DEBUGGER_FORCE "Force enable debugger in release mode" OFF)
|
||||
option(USE_SOCKET "Enable WebSocket & SocketIO" ON)
|
||||
option(USE_AUDIO "Enable Audio" ON) #Enable AudioEngine
|
||||
option(USE_EDIT_BOX "Enable EditBox" ON)
|
||||
option(USE_SE_JSC "Use JavaScriptCore on MacOSX/iOS" OFF)
|
||||
option(USE_VIDEO "Enable VideoPlayer Component" ON)
|
||||
option(USE_WEBVIEW "Enable WebView Component" ON)
|
||||
option(USE_MIDDLEWARE "Enable Middleware" ON)
|
||||
option(USE_DRAGONBONES "Enable Dragonbones" ON)
|
||||
option(USE_SPINE "Enable Spine" ON)
|
||||
option(USE_WEBSOCKET_SERVER "Enable WebSocket Server" OFF)
|
||||
option(USE_JOB_SYSTEM_TASKFLOW "Use taskflow as job system backend" OFF)
|
||||
option(USE_JOB_SYSTEM_TBB "Use tbb as job system backend" OFF)
|
||||
option(USE_PHYSICS_PHYSX "Use PhysX Physics" ON)
|
||||
option(USE_OCCLUSION_QUERY "Use Occlusion Query" ON)
|
||||
option(USE_DEBUG_RENDERER "Use Debug Renderer" ON)
|
||||
option(USE_GEOMETRY_RENDERER "Use Geometry Renderer" ON)
|
||||
option(USE_WEBP "Use Webp" ON)
|
||||
|
||||
if(NOT RES_DIR)
|
||||
message(FATAL_ERROR "RES_DIR is not set!")
|
||||
endif()
|
||||
|
||||
include(${RES_DIR}/proj/cfg.cmake)
|
||||
|
||||
if(NOT COCOS_X_PATH)
|
||||
message(FATAL_ERROR "COCOS_X_PATH is not set!")
|
||||
endif()
|
||||
|
||||
include(${COCOS_X_PATH}/CMakeLists.txt)
|
||||
|
||||
list(APPEND CC_COMMON_SOURCES
|
||||
${CMAKE_CURRENT_LIST_DIR}/Classes/Game.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/Classes/Game.cpp
|
||||
)
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
#include "Game.h"
|
||||
|
||||
#ifndef GAME_NAME
|
||||
#define GAME_NAME "CocosGame";
|
||||
#endif
|
||||
|
||||
#ifndef SCRIPT_XXTEAKEY
|
||||
#define SCRIPT_XXTEAKEY "";
|
||||
#endif
|
||||
|
||||
Game::Game() = default;
|
||||
|
||||
int Game::init() {
|
||||
_windowInfo.title = GAME_NAME;
|
||||
// configurate window size
|
||||
// _windowInfo.height = 600;
|
||||
// _windowInfo.width = 800;
|
||||
|
||||
#if CC_DEBUG
|
||||
_debuggerInfo.enabled = true;
|
||||
#else
|
||||
_debuggerInfo.enabled = false;
|
||||
#endif
|
||||
_debuggerInfo.port = 6086;
|
||||
_debuggerInfo.address = "0.0.0.0";
|
||||
_debuggerInfo.pauseOnStart = false;
|
||||
|
||||
_xxteaKey = SCRIPT_XXTEAKEY;
|
||||
|
||||
BaseGame::init();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Game::onPause() {
|
||||
BaseGame::onPause();
|
||||
}
|
||||
|
||||
void Game::onResume() {
|
||||
BaseGame::onResume();
|
||||
}
|
||||
|
||||
void Game::onClose() {
|
||||
BaseGame::onClose();
|
||||
}
|
||||
|
||||
CC_REGISTER_APPLICATION(Game);
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include "cocos/cocos.h"
|
||||
|
||||
/**
|
||||
@brief The cocos2d Application.
|
||||
|
||||
The reason for implement as private inheritance is to hide some interface call by Director.
|
||||
*/
|
||||
class Game : public cc::BaseGame {
|
||||
public:
|
||||
Game();
|
||||
int init() override;
|
||||
//bool init() override;
|
||||
void onPause() override;
|
||||
void onResume() override;
|
||||
void onClose() override;
|
||||
};
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"version":"3.6.0","skipCheck":false}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
//
|
||||
// Use this file to import your target's public headers that you would like to expose to Swift.
|
||||
//
|
||||
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2013 cocos2d-x.org
|
||||
Copyright (c) 2013-2016 Chukong Technologies Inc.
|
||||
Copyright (c) 2017-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "platform/ios/AppDelegateBridge.h"
|
||||
|
||||
@class ViewController;
|
||||
|
||||
@interface AppDelegate : NSObject <UIApplicationDelegate> {
|
||||
}
|
||||
|
||||
@property (nonatomic, readonly) ViewController* viewController;
|
||||
@property (nonatomic, readonly) AppDelegateBridge* appDelegateBridge;
|
||||
@end
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2013 cocos2d-x.org
|
||||
Copyright (c) 2013-2016 Chukong Technologies Inc.
|
||||
Copyright (c) 2017-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#import "AppDelegate.h"
|
||||
#import "ViewController.h"
|
||||
#import "View.h"
|
||||
|
||||
#include "platform/ios/IOSPlatform.h"
|
||||
#import "platform/ios/AppDelegateBridge.h"
|
||||
#import "service/SDKWrapper.h"
|
||||
|
||||
@implementation AppDelegate
|
||||
@synthesize window;
|
||||
@synthesize appDelegateBridge;
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Application lifecycle
|
||||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
[[SDKWrapper shared] application:application didFinishLaunchingWithOptions:launchOptions];
|
||||
appDelegateBridge = [[AppDelegateBridge alloc] init];
|
||||
|
||||
// Add the view controller's view to the window and display.
|
||||
CGRect bounds = [[UIScreen mainScreen] bounds];
|
||||
self.window = [[UIWindow alloc] initWithFrame:bounds];
|
||||
|
||||
// Should create view controller first, cc::Application will use it.
|
||||
_viewController = [[ViewController alloc] init];
|
||||
_viewController.view = [[View alloc] initWithFrame:bounds];
|
||||
_viewController.view.contentScaleFactor = UIScreen.mainScreen.scale;
|
||||
_viewController.view.multipleTouchEnabled = true;
|
||||
[self.window setRootViewController:_viewController];
|
||||
|
||||
[self.window makeKeyAndVisible];
|
||||
[appDelegateBridge application:application didFinishLaunchingWithOptions:launchOptions];
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)applicationWillResignActive:(UIApplication *)application {
|
||||
/*
|
||||
Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
|
||||
Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
|
||||
*/
|
||||
[[SDKWrapper shared] applicationWillResignActive:application];
|
||||
[appDelegateBridge applicationWillResignActive:application];
|
||||
}
|
||||
|
||||
- (void)applicationDidBecomeActive:(UIApplication *)application {
|
||||
/*
|
||||
Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
|
||||
*/
|
||||
[[SDKWrapper shared] applicationDidBecomeActive:application];
|
||||
[appDelegateBridge applicationDidBecomeActive:application];
|
||||
}
|
||||
|
||||
- (void)applicationDidEnterBackground:(UIApplication *)application {
|
||||
/*
|
||||
Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
|
||||
If your application supports background execution, called instead of applicationWillTerminate: when the user quits.
|
||||
*/
|
||||
[[SDKWrapper shared] applicationDidEnterBackground:application];
|
||||
}
|
||||
|
||||
- (void)applicationWillEnterForeground:(UIApplication *)application {
|
||||
/*
|
||||
Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background.
|
||||
*/
|
||||
[[SDKWrapper shared] applicationWillEnterForeground:application];
|
||||
}
|
||||
|
||||
- (void)applicationWillTerminate:(UIApplication *)application {
|
||||
[[SDKWrapper shared] applicationWillTerminate:application];
|
||||
[appDelegateBridge applicationWillTerminate:application];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Memory management
|
||||
|
||||
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
|
||||
[[SDKWrapper shared] applicationDidReceiveMemoryWarning:application];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13196" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
||||
<device id="retina5_9" orientation="landscape">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<deployment version="1792" identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13173"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="EHf-IW-A2E">
|
||||
<objects>
|
||||
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="fm7-M6-edp"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="uRH-d6-mvd"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||
<rect key="frame" x="0.0" y="0.0" width="812" height="375"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleAspectFill" insetsLayoutMarginsFromSafeArea="NO" image="LaunchScreenBackground.png" translatesAutoresizingMaskIntoConstraints="NO" id="YCC-wj-Gww" userLabel="Background">
|
||||
<rect key="frame" x="0.0" y="0.0" width="812" height="375"/>
|
||||
</imageView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="bottom" secondItem="YCC-wj-Gww" secondAttribute="bottom" id="Naz-ae-jWI"/>
|
||||
<constraint firstAttribute="trailing" secondItem="YCC-wj-Gww" secondAttribute="trailing" id="myj-85-hk9"/>
|
||||
<constraint firstItem="YCC-wj-Gww" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" id="qOq-Cg-doS"/>
|
||||
<constraint firstItem="YCC-wj-Gww" firstAttribute="top" secondItem="Ze5-6b-2t3" secondAttribute="top" id="xL7-Fo-4bl"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="50.399999999999999" y="373.15270935960592"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<image name="LaunchScreenBackground.png" width="2208" height="1242"/>
|
||||
</resources>
|
||||
</document>
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
/*
|
||||
Localizable.strings
|
||||
*/
|
||||
|
||||
"done" = "Done";
|
||||
"next" = "Next";
|
||||
"search" = "Search";
|
||||
"go" = "Go";
|
||||
"send" = "Send";
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
cmake_minimum_required(VERSION 3.8)
|
||||
|
||||
set(CMAKE_SYSTEM_NAME iOS)
|
||||
set(APP_NAME "cocos_demo_3" CACHE STRING "Project Name")
|
||||
|
||||
project(${APP_NAME} CXX)
|
||||
|
||||
set(CC_PROJECT_DIR ${CMAKE_CURRENT_LIST_DIR})
|
||||
set(CC_UI_RESOURCES)
|
||||
set(CC_PROJ_SOURCES)
|
||||
set(CC_ASSET_FILES)
|
||||
set(CC_COMMON_SOURCES)
|
||||
set(CC_ALL_SOURCES)
|
||||
|
||||
include(${CC_PROJECT_DIR}/../common/CMakeLists.txt)
|
||||
set(EXECUTABLE_NAME ${APP_NAME}-mobile)
|
||||
|
||||
cc_ios_before_target(${EXECUTABLE_NAME})
|
||||
add_executable(${EXECUTABLE_NAME} ${CC_ALL_SOURCES})
|
||||
cc_ios_after_target(${EXECUTABLE_NAME})
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
//
|
||||
// CocosNative.m
|
||||
// boost_container
|
||||
//
|
||||
// Created by 雨川 on 2022/9/6.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
After Width: | Height: | Size: 216 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 4.6 KiB |
|
After Width: | Height: | Size: 4.7 KiB |
|
After Width: | Height: | Size: 4.9 KiB |
|
After Width: | Height: | Size: 7.4 KiB |
|
After Width: | Height: | Size: 8.3 KiB |
|
|
@ -0,0 +1 @@
|
|||
{"images":[{"size":"60x60","expected-size":"180","filename":"180.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"40x40","expected-size":"80","filename":"80.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"40x40","expected-size":"120","filename":"120.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"60x60","expected-size":"120","filename":"120.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"57x57","expected-size":"57","filename":"57.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"1x"},{"size":"29x29","expected-size":"58","filename":"58.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"29x29","expected-size":"29","filename":"29.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"1x"},{"size":"29x29","expected-size":"87","filename":"87.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"57x57","expected-size":"114","filename":"114.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"20x20","expected-size":"40","filename":"40.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"20x20","expected-size":"60","filename":"60.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"1024x1024","filename":"1024.png","expected-size":"1024","idiom":"ios-marketing","folder":"Assets.xcassets/AppIcon.appiconset/","scale":"1x"}]}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIcons~ipad</key>
|
||||
<dict/>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSAllowsArbitraryLoads</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>UIPrerenderedIcon</key>
|
||||
<true/>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<dict>
|
||||
<key>accelerometer</key>
|
||||
<true/>
|
||||
<key>opengles-1</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>UIRequiresFullScreen</key>
|
||||
<true/>
|
||||
<key>UIStatusBarHidden</key>
|
||||
<true/>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
//
|
||||
// JSHandleClass.h
|
||||
// TestDemo
|
||||
//
|
||||
// Created by Etrent on 2022/9/5.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface JSHandleClass : NSObject
|
||||
|
||||
|
||||
+ (void)init;
|
||||
+ (void)walleConnectFun:(NSString*) urlTypesStr;
|
||||
+ (void)sendMessageFun:(NSString*) jsonStr;
|
||||
+ (void)sendContractFun:(NSString*) jsonStr;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
//
|
||||
// JSHandleClass.m
|
||||
// TestDemo
|
||||
//
|
||||
// Created by Etrent on 2022/9/5.
|
||||
//
|
||||
|
||||
#import "JSHandleClass.h"
|
||||
#import "cocos_demo_3_mobile-Swift.h"
|
||||
|
||||
MyWalletConnect* wc;
|
||||
@implementation JSHandleClass
|
||||
|
||||
+ (void) init{
|
||||
wc =[MyWalletConnect alloc];
|
||||
[wc initWalleConnect];
|
||||
NSLog(@"调用到了init");
|
||||
}
|
||||
|
||||
+ (void)walleConnectFun:(NSString*)urlTypesStr {
|
||||
[wc walleConnectFunWithUrlTypeStr:urlTypesStr];
|
||||
NSLog(@"调用到了walleConnectFun");
|
||||
}
|
||||
|
||||
|
||||
+ (void)sendMessageFun:(NSString*)jsonStr {
|
||||
[wc customRequestsWithJsonStr:jsonStr];
|
||||
// @"{\"method\": \"personal_sign\",\"params\": [\"0x49206861766520313030e282ac\",\"0x2eB535d54382eA5CED9183899916A9d39e093877\"]}"
|
||||
[wc walleConnectFunWithUrlTypeStr:@"imtokenv2"];
|
||||
}
|
||||
|
||||
+ (void)sendContractFun:(NSString*)jsonStr {
|
||||
[wc contractRequestWithJsonStr:jsonStr];
|
||||
// @"{\"method\": \"personal_sign\",\"params\": [\"0x49206861766520313030e282ac\",\"0x2eB535d54382eA5CED9183899916A9d39e093877\"]}"
|
||||
[wc walleConnectFunWithUrlTypeStr:@"imtokenv2"];
|
||||
}
|
||||
|
||||
@end
|
||||
|
After Width: | Height: | Size: 656 KiB |
|
After Width: | Height: | Size: 656 KiB |
|
After Width: | Height: | Size: 454 KiB |
|
|
@ -0,0 +1 @@
|
|||
# Supported for Cocos Service!
|
||||
|
|
@ -0,0 +1 @@
|
|||
# Supported for Cocos Service!
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
//
|
||||
// Prefix header for all source files of the 'HelloJavascript' target in the 'HelloJavascript' project
|
||||
//
|
||||
|
||||
#ifdef __OBJC__
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
#endif
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
Copyright (c) 2013-2016 Chukong Technologies Inc.
|
||||
Copyright (c) 2017-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface ViewController : UIViewController
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
Copyright (c) 2013-2016 Chukong Technologies Inc.
|
||||
Copyright (c) 2017-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#import "ViewController.h"
|
||||
#import "AppDelegate.h"
|
||||
#import "platform/ios/AppDelegateBridge.h"
|
||||
//#include "cocos/platform/Device.h"
|
||||
|
||||
namespace {
|
||||
// cc::Device::Orientation _lastOrientation;
|
||||
}
|
||||
|
||||
@interface ViewController ()
|
||||
|
||||
@end
|
||||
|
||||
@implementation ViewController
|
||||
|
||||
|
||||
- (BOOL) shouldAutorotate {
|
||||
return YES;
|
||||
}
|
||||
|
||||
//fix not hide status on ios7
|
||||
- (BOOL)prefersStatusBarHidden {
|
||||
return YES;
|
||||
}
|
||||
|
||||
// Controls the application's preferred home indicator auto-hiding when this view controller is shown.
|
||||
- (BOOL)prefersHomeIndicatorAutoHidden {
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {
|
||||
AppDelegate* delegate = [[UIApplication sharedApplication] delegate];
|
||||
[delegate.appDelegateBridge viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
|
||||
float pixelRatio = [delegate.appDelegateBridge getPixelRatio];
|
||||
|
||||
//CAMetalLayer is available on ios8.0, ios-simulator13.0.
|
||||
CAMetalLayer *layer = (CAMetalLayer *)self.view.layer;
|
||||
CGSize tsize = CGSizeMake(static_cast<int>(size.width * pixelRatio),
|
||||
static_cast<int>(size.height * pixelRatio));
|
||||
layer.drawableSize = tsize;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
//
|
||||
// Copyright © 2019 Gnosis Ltd. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import WalletConnectSwift
|
||||
|
||||
protocol WalletConnectDelegate {
|
||||
func failedToConnect()
|
||||
func didConnect()
|
||||
func didDisconnect()
|
||||
}
|
||||
|
||||
class WalletConnect {
|
||||
var client: Client!
|
||||
var session: Session!
|
||||
var delegate: WalletConnectDelegate
|
||||
|
||||
let sessionKey = "sessionKey"
|
||||
|
||||
init(delegate: WalletConnectDelegate) {
|
||||
self.delegate = delegate
|
||||
}
|
||||
|
||||
func connect() -> String {
|
||||
// gnosis wc bridge: https://safe-walletconnect.gnosis.io/
|
||||
// test bridge with latest protocol version: https://bridge.walletconnect.org
|
||||
let wcUrl = WCURL(topic: UUID().uuidString,
|
||||
bridgeURL: URL(string: "https://safe-walletconnect.gnosis.io/")!,
|
||||
key: try! randomKey())
|
||||
let clientMeta = Session.ClientMeta(name: "ExampleDApp",
|
||||
description: "WalletConnectSwift",
|
||||
icons: [],
|
||||
url: URL(string: "https://safe.gnosis.io")!)
|
||||
let dAppInfo = Session.DAppInfo(peerId: UUID().uuidString, peerMeta: clientMeta)
|
||||
client = Client(delegate: self, dAppInfo: dAppInfo)
|
||||
|
||||
print("WalletConnect URL: \(wcUrl.absoluteString)")
|
||||
|
||||
try! client.connect(to: wcUrl)
|
||||
return wcUrl.absoluteString
|
||||
}
|
||||
|
||||
func reconnectIfNeeded() {
|
||||
if let oldSessionObject = UserDefaults.standard.object(forKey: sessionKey) as? Data,
|
||||
let session = try? JSONDecoder().decode(Session.self, from: oldSessionObject) {
|
||||
client = Client(delegate: self, dAppInfo: session.dAppInfo)
|
||||
try? client.reconnect(to: session)
|
||||
}
|
||||
}
|
||||
|
||||
// https://developer.apple.com/documentation/security/1399291-secrandomcopybytes
|
||||
private func randomKey() throws -> String {
|
||||
var bytes = [Int8](repeating: 0, count: 32)
|
||||
let status = SecRandomCopyBytes(kSecRandomDefault, bytes.count, &bytes)
|
||||
if status == errSecSuccess {
|
||||
return Data(bytes: bytes, count: 32).toHexString()
|
||||
} else {
|
||||
// we don't care in the example app
|
||||
enum TestError: Error {
|
||||
case unknown
|
||||
}
|
||||
throw TestError.unknown
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension WalletConnect: ClientDelegate {
|
||||
func client(_ client: Client, didFailToConnect url: WCURL) {
|
||||
delegate.failedToConnect()
|
||||
}
|
||||
|
||||
func client(_ client: Client, didConnect url: WCURL) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
func client(_ client: Client, didConnect session: Session) {
|
||||
self.session = session
|
||||
print("session+++___++_\(session.url)")
|
||||
let sessionData = try! JSONEncoder().encode(session)
|
||||
UserDefaults.standard.set(sessionData, forKey: sessionKey)
|
||||
delegate.didConnect()
|
||||
}
|
||||
|
||||
func client(_ client: Client, didDisconnect session: Session) {
|
||||
UserDefaults.standard.removeObject(forKey: sessionKey)
|
||||
delegate.didDisconnect()
|
||||
}
|
||||
|
||||
func client(_ client: Client, didUpdate session: Session) {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
//
|
||||
// Use this file to import your target's public headers that you would like to expose to Swift.
|
||||
//
|
||||
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "platform/BasePlatform.h"
|
||||
#include "AppDelegate.h"
|
||||
|
||||
int main(int argc, const char * argv[]) {
|
||||
cc::BasePlatform* platform = cc::BasePlatform::getPlatform();
|
||||
if (platform->init()) {
|
||||
return -1;
|
||||
}
|
||||
platform->run(argc, argv);
|
||||
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
|
||||
int retVal = UIApplicationMain(argc, (char**)argv, nil, @"AppDelegate");
|
||||
[pool release];
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,143 @@
|
|||
//
|
||||
// myWalletConnect.swift
|
||||
// Runner
|
||||
//
|
||||
// Created by 雨川 on 2022/8/31.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import WalletConnectSwift
|
||||
|
||||
|
||||
@objcMembers class MyWalletConnect:NSObject {
|
||||
var walletConnect:WalletConnect!
|
||||
var client: Client!
|
||||
var session: Session!
|
||||
var cr:String!
|
||||
///初始化
|
||||
func initWalleConnect(){
|
||||
walletConnect = WalletConnect(delegate: self)
|
||||
walletConnect.reconnectIfNeeded()
|
||||
|
||||
NSLog("开始初始化")
|
||||
cr = walletConnect.connect()
|
||||
client = walletConnect.client
|
||||
session = walletConnect.session
|
||||
}
|
||||
|
||||
///链接钱包
|
||||
func walleConnectFun(urlTypeStr:String)->Void{
|
||||
|
||||
let deepLinkUrl = "wc"+"://wc?uri=\(cr!)"
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
|
||||
if let url = URL(string: deepLinkUrl), UIApplication.shared.canOpenURL(url) {
|
||||
UIApplication.shared.open(url, options: [:], completionHandler: nil)
|
||||
} else {
|
||||
print(deepLinkUrl);
|
||||
NSLog("开始初始化检测不支持")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func customRequests(jsonStr:String){
|
||||
let jsonData:Data = jsonStr.data(using: .utf8)!
|
||||
|
||||
let dict = try? JSONSerialization.jsonObject(with: jsonData, options: .mutableContainers) as? Dictionary<String, Any>
|
||||
|
||||
try? client.send(.eth_custom(url: walletConnect.session.url,methods:dict?["method"] as! String,param:dict?["params"] as! Array<String>)) { [weak self] response in
|
||||
self?.handleReponse(response, expecting: "Gas Price")
|
||||
}
|
||||
|
||||
}
|
||||
func contractRequest(jsonStr:String){
|
||||
let jsonData:Data = jsonStr.data(using: .utf8)!
|
||||
print("进入了")
|
||||
let dict = try? JSONSerialization.jsonObject(with: jsonData, options: .mutableContainers) as? Dictionary<String, Any>
|
||||
let optionsData:Data = (dict?["params"] as! String).data(using: .utf8)!
|
||||
let data = try? JSONSerialization.jsonObject(with: optionsData, options: .mutableContainers) as? Dictionary<String, Any>
|
||||
var options = ContractStruct(from: data?["from"] as! String,to:data?["to"] as! String,value: "",data: data?["data"] as! String)
|
||||
try? client.send(.eth_custom(url: walletConnect.session.url,methods:dict?["method"] as! String,contractOptions:[options])) { [weak self] response in
|
||||
self?.handleReponse(response, expecting: "Gas Price")
|
||||
}
|
||||
|
||||
}
|
||||
func cooidn(json:String,id:String){}
|
||||
|
||||
private func handleReponse(_ response: Response, expecting: String) {
|
||||
DispatchQueue.main.async {
|
||||
if let error = response.error {
|
||||
self.show(UIAlertController(title: "Error", message: error.localizedDescription, preferredStyle: .alert))
|
||||
return
|
||||
}
|
||||
do {
|
||||
let result = try response.result(as: String.self)
|
||||
self.show(UIAlertController(title: expecting, message: result, preferredStyle: .alert))
|
||||
} catch {
|
||||
self.show(UIAlertController(title: "Error",
|
||||
message: "Unexpected response type error: \(error)",
|
||||
preferredStyle: .alert))
|
||||
}
|
||||
}
|
||||
}
|
||||
private func show(_ alert: UIAlertController) {
|
||||
alert.addAction(UIAlertAction(title: "Close", style: .cancel))
|
||||
// self.present(alert, animated: true)
|
||||
}
|
||||
func onMainThread(_ closure: @escaping () -> Void) {
|
||||
if Thread.isMainThread {
|
||||
closure()
|
||||
} else {
|
||||
DispatchQueue.main.async {
|
||||
closure()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct ContractStruct: Codable, Equatable {
|
||||
var from: String;
|
||||
var to:String;
|
||||
var value:String;
|
||||
var data:String;
|
||||
|
||||
}
|
||||
|
||||
|
||||
extension Request {
|
||||
static func eth_getTransactionCount(url: WCURL, account: String) -> Request {
|
||||
return try! Request(url: url, method: "eth_getTransactionCount", params: [account, "latest"])
|
||||
}
|
||||
|
||||
static func eth_gasPrice(url: WCURL) -> Request {
|
||||
return Request(url: url, method: "eth_gasPrice")
|
||||
}
|
||||
//[{from:"abc"}]
|
||||
// ["0x4ede150f62dc21adc0f39a2a02c95a5cc1fd7b2c","0x62cC9fd83d48eFCe313695bA6a3245bCCC7f196e","0x3c3284d10000000000000000000000002eb535d54382ea5ced9183899916a9d39e093877"]
|
||||
static func eth_custom(url:WCURL,methods:String,param:Array<String>) -> Request{
|
||||
return try! Request(url: url, method: methods, params:param )
|
||||
}
|
||||
static func eth_custom(url:WCURL,methods:String,contractOptions:Array<ContractStruct>) -> Request{
|
||||
return try! Request(url: url, method: methods, params:contractOptions )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
extension MyWalletConnect: WalletConnectDelegate {
|
||||
func failedToConnect() {
|
||||
onMainThread { [unowned self] in
|
||||
NSLog("didConnect") }
|
||||
}
|
||||
|
||||
func didConnect() {
|
||||
onMainThread { [unowned self] in
|
||||
print("session+++++==============\(walletConnect.session.url)")
|
||||
NSLog("didConnect")
|
||||
}
|
||||
}
|
||||
|
||||
func didDisconnect() {
|
||||
onMainThread { [unowned self] in
|
||||
NSLog("didConnect")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2017-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol SDKDelegate <NSObject>
|
||||
|
||||
@optional
|
||||
- (void)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions;
|
||||
- (void)applicationDidBecomeActive:(UIApplication *)application;
|
||||
- (void)applicationWillResignActive:(UIApplication *)application;
|
||||
- (void)applicationDidEnterBackground:(UIApplication *)application;
|
||||
- (void)applicationWillEnterForeground:(UIApplication *)application;
|
||||
- (void)applicationWillTerminate:(UIApplication *)application;
|
||||
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application;
|
||||
|
||||
@end
|
||||
|
||||
@interface SDKWrapper : NSObject
|
||||
@property (nonatomic, strong) NSString *name;
|
||||
+ (instancetype)shared;
|
||||
- (void)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions;
|
||||
- (void)applicationDidBecomeActive:(UIApplication *)application;
|
||||
- (void)applicationWillResignActive:(UIApplication *)application;
|
||||
- (void)applicationDidEnterBackground:(UIApplication *)application;
|
||||
- (void)applicationWillEnterForeground:(UIApplication *)application;
|
||||
- (void)applicationWillTerminate:(UIApplication *)application;
|
||||
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
|
@ -0,0 +1,142 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2017-2020 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
#import "SDKWrapper.h"
|
||||
|
||||
@interface SDKWrapper ()
|
||||
|
||||
@property (nonatomic, strong) NSArray *serviceInstances;
|
||||
|
||||
@end
|
||||
|
||||
@implementation SDKWrapper
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Singleton
|
||||
|
||||
static SDKWrapper *mInstace = nil;
|
||||
|
||||
+ (instancetype)shared {
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
mInstace = [[super allocWithZone:NULL] init];
|
||||
[mInstace initSDKWrapper];
|
||||
});
|
||||
return mInstace;
|
||||
}
|
||||
+ (id)allocWithZone:(struct _NSZone *)zone {
|
||||
return [SDKWrapper shared];
|
||||
}
|
||||
|
||||
+ (id)copyWithZone:(struct _NSZone *)zone {
|
||||
return [SDKWrapper shared];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark private methods
|
||||
- (void)initSDKWrapper {
|
||||
[self loadSDKClass];
|
||||
}
|
||||
|
||||
- (void)loadSDKClass {
|
||||
NSMutableArray *sdks = [NSMutableArray array];
|
||||
@try {
|
||||
NSString *path = [NSString stringWithFormat:@"%@/service.json", [[NSBundle mainBundle] resourcePath]];
|
||||
NSData *data = [NSData dataWithContentsOfFile:path options:NSDataReadingMappedIfSafe error:nil];
|
||||
id obj = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
|
||||
id dic = obj[@"serviceClasses"];
|
||||
if (dic == nil) @throw [[NSException alloc] initWithName:@"JSON Exception" reason:@"serviceClasses not found" userInfo:nil];
|
||||
for (NSString *str in dic) {
|
||||
NSString *className = [[str componentsSeparatedByString:@"."] lastObject];
|
||||
Class clazz = NSClassFromString(className);
|
||||
if (clazz == nil) @throw [[NSException alloc] initWithName:@"Cass Exception"
|
||||
reason:[NSString stringWithFormat:@"class '%@' not found", className]
|
||||
userInfo:nil];
|
||||
id sdk = [[clazz alloc] init];
|
||||
[sdks addObject:sdk];
|
||||
}
|
||||
} @catch (NSException *e) {
|
||||
}
|
||||
self.serviceInstances = [NSArray arrayWithArray:sdks];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Application lifecycle
|
||||
- (void)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
for (id <SDKDelegate> sdk in self.serviceInstances) {
|
||||
if ([sdk respondsToSelector:@selector(application:didFinishLaunchingWithOptions:)]) {
|
||||
[sdk application:application didFinishLaunchingWithOptions:launchOptions];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (void)applicationDidBecomeActive:(UIApplication *)application {
|
||||
for (id sdk in self.serviceInstances) {
|
||||
if ([sdk respondsToSelector:@selector(applicationDidBecomeActive:)]) {
|
||||
[sdk applicationDidBecomeActive:application];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)applicationWillResignActive:(UIApplication *)application {
|
||||
for (id sdk in self.serviceInstances) {
|
||||
if ([sdk respondsToSelector:@selector(applicationWillResignActive:)]) {
|
||||
[sdk applicationWillResignActive:application];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)applicationDidEnterBackground:(UIApplication *)application {
|
||||
for (id sdk in self.serviceInstances) {
|
||||
if ([sdk respondsToSelector:@selector(applicationDidEnterBackground:)]) {
|
||||
[sdk applicationDidEnterBackground:application];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)applicationWillEnterForeground:(UIApplication *)application {
|
||||
for (id sdk in self.serviceInstances) {
|
||||
if ([sdk respondsToSelector:@selector(applicationWillEnterForeground:)]) {
|
||||
[sdk applicationWillEnterForeground:application];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)applicationWillTerminate:(UIApplication *)application {
|
||||
for (id sdk in self.serviceInstances) {
|
||||
if ([sdk respondsToSelector:@selector(applicationWillTerminate:)]) {
|
||||
[sdk applicationWillTerminate:application];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
|
||||
for (id sdk in self.serviceInstances) {
|
||||
if ([sdk respondsToSelector:@selector(applicationDidReceiveMemoryWarning:)]) {
|
||||
[sdk applicationDidReceiveMemoryWarning:application];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
/*
|
||||
Localizable.strings
|
||||
*/
|
||||
|
||||
"done" = "完成";
|
||||
"next" = "下一个";
|
||||
"search" = "搜索";
|
||||
"go" = "前往";
|
||||
"send" = "发送";
|
||||