Browse Source

missing colors

shuvit 5 years ago
parent
commit
8417648cf6
3 changed files with 51 additions and 4 deletions
  1. 3
    0
      assets/user1.blend1
  2. 45
    4
      scripts/Settings.py
  3. 3
    0
      shuvit.blend1

+ 3
- 0
assets/user1.blend1 View File

1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:b849f1bbfec79edaa9c02c2a9292a6a69fb05ce45a61cc92d9ea133db9f17f13
3
+size 2159852

+ 45
- 4
scripts/Settings.py View File

4
 from configobj import ConfigObj
4
 from configobj import ConfigObj
5
 
5
 
6
 mainDir = GameLogic.expandPath("//")
6
 mainDir = GameLogic.expandPath("//")
7
-
8
 fileName = mainDir + "config.ini"
7
 fileName = mainDir + "config.ini"
9
 
8
 
10
 config = ConfigObj(fileName, interpolation=True)
9
 config = ConfigObj(fileName, interpolation=True)
25
             except:
24
             except:
26
                 pass
25
                 pass
27
     dict[key] = value  
26
     dict[key] = value  
27
+    #print(key, value)
28
+    
29
+def readChar():
30
+    mainDir = GameLogic.expandPath("//characters/")    
31
+    fileName = mainDir + dict['character'] + ".ini"
32
+    print('loading character settings', fileName)
33
+    char_config = ConfigObj(fileName, interpolation=True)
34
+    
35
+    
36
+    def to_dict2(section, key):
37
+        dict = bge.logic.globalDict
38
+        value = char_config[key]
39
+        if isinstance(value, str):
40
+            if value.isdigit():
41
+                value = int(value)
42
+            else:
43
+                try:
44
+                    value = float(value)
45
+                except:
46
+                    pass
47
+        dict[key] = value  
48
+        print(key, value)      
49
+    
50
+    
51
+    char_config.walk(to_dict2, char_config)
52
+    
53
+def writeChar():
54
+    dict = bge.logic.globalDict
55
+    mainDir = GameLogic.expandPath("//characters/")    
56
+    fileName = mainDir + dict['character'] + ".ini"
57
+    print('writing character settings', fileName)
58
+    char_config = ConfigObj(fileName, interpolation=True)  
59
+    
60
+    def from_dict2(section, key):
61
+        char_config[key] = dict[key]
62
+    
63
+    char_config.walk(from_dict2)  
64
+    #char_config[key] = dict[key] 
65
+    char_config.write()
66
+    
28
 
67
 
29
 def readSettings():
68
 def readSettings():
30
-    config.walk(to_dict)     
69
+    config.walk(to_dict)         
70
+    readChar()
31
 
71
 
32
 def from_dict(section, key):
72
 def from_dict(section, key):
33
     dict = bge.logic.globalDict
73
     dict = bge.logic.globalDict
35
 
75
 
36
 def writeSettings():
76
 def writeSettings():
37
     config.walk(from_dict)  
77
     config.walk(from_dict)  
38
-    config.write()    
39
-          
78
+    config.write()  
79
+    dict = bge.logic.globalDict
80
+     
40
 def setres():
81
 def setres():
41
     import GameLogic
82
     import GameLogic
42
     import bge
83
     import bge

+ 3
- 0
shuvit.blend1 View File

1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:1fc70f8f00aeada759e90ba8435b3d7cef644ea66a994cd77f8c7e85807ba837
3
+size 182501724

Loading…
Cancel
Save