NexusFine 0.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
nexusfine/__init__.py ADDED
@@ -0,0 +1,4 @@
1
+ from .core import NF, NB, NC, NS, NexusEngine
2
+
3
+ __version__ = '0.2.0'
4
+ __all__ = ['NF', 'NB', 'NC', 'NS', 'NexusEngine']
nexusfine/core.py ADDED
@@ -0,0 +1,144 @@
1
+ 、"""
2
+ NexusFine 核心引擎
3
+ """
4
+
5
+ import requests
6
+
7
+
8
+ class NexusEngine:
9
+ def __init__(self, name="NexusFine"):
10
+ self.name = name
11
+ self.api_key = None
12
+ self.axes = []
13
+ self.game_name = None
14
+ self.mode = None
15
+ self.duration = None
16
+ self.system_dims = 0
17
+ self.api_url = "https://api.nexusfine.ai/v1"
18
+
19
+ def __call__(self, *args):
20
+ if len(args) == 0:
21
+ return self
22
+
23
+ arg = args[0]
24
+
25
+ # NF("Game.exe") → 启动游戏
26
+ if isinstance(arg, str) and arg.endswith('.exe'):
27
+ self.game_name = arg
28
+ self._start_game()
29
+ return self
30
+
31
+ # NF(a) → API 密钥或注册轴
32
+ if isinstance(arg, str):
33
+ if arg.startswith('SK-'):
34
+ self.api_key = arg
35
+ print(f"✅ API: {arg[:10]}...")
36
+ else:
37
+ self._register_axis(arg)
38
+ return self
39
+
40
+ # NF(a, b) 或 NF(config, axis) → 构建系统
41
+ if len(args) >= 2:
42
+ for item in args:
43
+ if isinstance(item, dict):
44
+ self._apply_config(item)
45
+ elif isinstance(item, str):
46
+ self._register_axis(item)
47
+ self._build_system()
48
+ return self
49
+
50
+ return self
51
+
52
+ def set_mode(self, mode):
53
+ """设置档位 NF.{NS=A} → NF.set_mode('A')"""
54
+ self.mode = mode
55
+ mode_names = {'A': '高性能', 'B': '平衡', 'C': '省电'}
56
+ print(f"⚙️ 档位: {mode} ({mode_names.get(mode, '自定义')})")
57
+ return self
58
+
59
+ def _register_axis(self, name):
60
+ if name not in self.axes:
61
+ self.axes.append(name)
62
+ label = ['X', 'Y', 'Z'][len(self.axes)-1] if len(self.axes) <= 3 else str(len(self.axes))
63
+ print(f"📐 {label}轴: {name}")
64
+
65
+ def _apply_config(self, config):
66
+ if 'mode' in config:
67
+ self.mode = config['mode']
68
+ if 'duration' in config:
69
+ self.duration = config['duration']
70
+ print(f"📋 配置: 档位={self.mode}, 时长={self.duration}s")
71
+
72
+ def _build_system(self):
73
+ self.system_dims = len(self.axes)
74
+ if self.system_dims == 2:
75
+ print(f"🎯 构建2D系统 (X, Y)")
76
+ elif self.system_dims == 3:
77
+ print(f"🎯 构建3D系统 (X, Y, Z)")
78
+ else:
79
+ print(f"🎯 构建{self.system_dims}D系统")
80
+
81
+ def _start_game(self):
82
+ print(f"\n{'='*50}")
83
+ print(f"🎮 启动游戏: {self.game_name}")
84
+ print(f"📐 维度: {self.system_dims}D")
85
+ print(f"⚙️ 档位: {self.mode or '默认'}")
86
+ print(f"🔑 API: {self.api_key[:10] if self.api_key else '未设置'}...")
87
+ print(f"📊 轴: {self.axes}")
88
+ print(f"{'='*50}\n")
89
+
90
+ if self.api_key:
91
+ self._ai_init()
92
+ else:
93
+ print("⚠️ 使用本地引擎")
94
+
95
+ def _ai_init(self):
96
+ if not self.api_key:
97
+ return
98
+
99
+ headers = {
100
+ "Authorization": f"Bearer {self.api_key}",
101
+ "Content-Type": "application/json"
102
+ }
103
+
104
+ data = {
105
+ "game": self.game_name,
106
+ "axes": self.axes,
107
+ "dims": self.system_dims,
108
+ "mode": self.mode,
109
+ "duration": self.duration
110
+ }
111
+
112
+ try:
113
+ response = requests.post(
114
+ f"{self.api_url}/init",
115
+ headers=headers,
116
+ json=data,
117
+ timeout=5
118
+ )
119
+ if response.status_code == 200:
120
+ print("✅ AI引擎初始化成功")
121
+ else:
122
+ print(f"❌ AI初始化失败: {response.status_code}")
123
+ except:
124
+ print("⏰ 使用本地引擎")
125
+
126
+
127
+ class NexusSteamConfig:
128
+ """蒸汽配置系统"""
129
+
130
+ @staticmethod
131
+ def config(target, mode="A", duration=20.0):
132
+ """NS[[NF.NexusFine], (NF=A=20s)] → NS.config('NF', mode='A', duration=20)"""
133
+ print(f"🔧 配置生成: 目标={target}, 档位={mode}, 时长={duration}s")
134
+ return {"target": target, "mode": mode, "duration": duration}
135
+
136
+
137
+ # ============ 导出 ============
138
+
139
+ NF = NexusEngine("NexusFine")
140
+ NB = NexusEngine("NexusBall")
141
+ NC = NexusEngine("NexusCloud")
142
+ NS = NexusSteamConfig()
143
+
144
+ __all__ = ['NF', 'NB', 'NC', 'NS']
@@ -0,0 +1,11 @@
1
+ Metadata-Version: 2.4
2
+ Name: NexusFine
3
+ Version: 0.2.0
4
+ Summary: AI驱动的物理游戏引擎 - 聚合设计
5
+ Author: bengtiaotiao
6
+ Requires-Python: >=3.6
7
+ Requires-Dist: requests>=2.25.0
8
+ Dynamic: author
9
+ Dynamic: requires-dist
10
+ Dynamic: requires-python
11
+ Dynamic: summary
@@ -0,0 +1,6 @@
1
+ nexusfine/__init__.py,sha256=FZ_lbPBY0xFHRMRn4i728rzXZATcsrBO3GNwdJKXVms,121
2
+ nexusfine/core.py,sha256=wkgsyD2Jp-8-hw4D3uKvb4oLRFY4m5o3LX3bpw6oUGs,4559
3
+ nexusfine-0.2.0.dist-info/METADATA,sha256=IZvVnxUMgA0xedcHSJ9-8GQdNotJ6UXLo9dc9fVuP3s,275
4
+ nexusfine-0.2.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
5
+ nexusfine-0.2.0.dist-info/top_level.txt,sha256=YxLc5yYH8u4MyzL6BwwpeGAg7rorEf8E3XUwL-Xx9jo,10
6
+ nexusfine-0.2.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ nexusfine