﻿window.Rendxx = window.Rendxx || {};
window.Rendxx.Game = window.Rendxx.Game || {};
window.Rendxx.Game.Ghost = window.Rendxx.Game.Ghost || {};
window.Rendxx.Game.Ghost.System = window.Rendxx.Game.Ghost.System || {};

/**
 * Message manager
 */
(function (SYSTEM) {
    var Data = SYSTEM.Data;
    var _Data = {
        'Key': 'Key',
        'OpenDoor': 'OpenDoor',
        'CloseDoor': 'CloseDoor',
        'Unlock': 'Unlock',
        'CantOpen': 'CantOpen',
        'OpenCarbinet': 'OpenCarbinet',
        'CloseCarbinet': 'CloseCarbinet',
        'Walk': 'Walk',
        'Run': 'Run',
        'Danger': 'Danger',
        'Die': 'Die',
        'Scream': 'Scream'
    }
    var Sound = function (entity) {
        // data ----------------------------------------------------------
        var that = this,
            _sounds_once = {},
            _sounds_conherent = {}
        
        // callback ------------------------------------------------------

        // public method -------------------------------------------------
        this.once = function (characterId, soundName) {
            _sounds_once[characterId] = soundName;
        };

        this.coherent = function (characterId, soundName, isOn) {
            _sounds_conherent[characterId] = isOn ? 1 : 0;
        };

        this.getSoundDat = function () {
            var s = [_sounds_once, _sounds_conherent];
            _sounds_once = {};
            return s;
        };

        // setup -----------------------------------------------
        var _init = function () {
        };
        _init();
    };

    SYSTEM.Sound = Sound;
    SYSTEM.Sound.Data = _Data;
})(window.Rendxx.Game.Ghost.System);
@@ -317,22 +317,42 @@
     
-'Key': 'Key',%0A
+Name: %7B%0A            'Key': 0,%0A    
     
@@ -371,20 +371,15 @@
 r': 
-'OpenDoor',%0A
+1,%0A    
     
@@ -395,27 +395,17 @@
 eDoor': 
-'CloseDoor'
+2
 ,%0A      
@@ -406,16 +406,20 @@
         
+    
 'Unlock'
@@ -424,18 +424,15 @@
 k': 
-'Unlock',%0A
+3,%0A    
     
@@ -451,20 +451,15 @@
 n': 
-'CantOpen',%0A
+4,%0A    
     
@@ -482,24 +482,15 @@
 t': 
-'OpenCarbinet',%0A
+5,%0A    
     
@@ -514,25 +514,15 @@
 t': 
-'CloseCarbinet',%0A
+6,%0A    
     
@@ -537,16 +537,15 @@
 k': 
-'Walk',%0A
+7,%0A    
     
@@ -555,21 +555,17 @@
  'Run': 
-'Run'
+8
 ,%0A      
@@ -566,16 +566,20 @@
         
+    
 'Danger'
@@ -584,18 +584,15 @@
 r': 
-'Danger',%0A
+9,%0A    
     
@@ -606,15 +606,16 @@
 e': 
-'Die',%0A
+10,%0A    
     
@@ -628,24 +628,179 @@
 cream': 
-'Scream'
+11%0A        %7D,%0A        Type: %7B%0A            'Character': 0,%0A            'Furniture': 1,%0A            'Door': 2,%0A            'Stuff': 3,%0A            'Body':4%0A        %7D
 %0A    %7D%0A 
@@ -1186,34 +1186,34 @@
 = function (
-characterI
+objType, i
 d, soundName
@@ -1241,31 +1241,167 @@
 ds_once%5B
-characterId%5D = 
+objType%5D = _sounds_once%5BobjType%5D %7C%7C %7B%7D;%0A            _sounds_once%5BobjType%5D%5Bid%5D = _sounds_once%5BobjType%5D%5Bid%5D %7C%7C %7B%7D;%0A            _sounds_once%5BobjType%5D%5Bid%5D%5B
 soundNam
@@ -1401,16 +1401,19 @@
 oundName
+%5D=1
 ;%0A      
@@ -1452,26 +1452,26 @@
 nction (
-characterI
+objType, i
 d, sound
@@ -1518,35 +1518,190 @@
 ent%5B
-characterId%5D = isOn ? 1 : 0
+objType%5D%5Bid%5D = _sounds_once%5BobjType%5D%5Bid%5D %7C%7C %7B%7D;%0A            if (isOn) _sounds_conherent%5BobjType%5D%5Bid%5D%5BsoundName%5D = 1;%0A            else delete _sounds_conherent%5BobjType%5D%5Bid%5D%5BsoundName%5D
 ;%0A  
@@ -1962,32 +1962,141 @@
 = function () %7B%0A
+            for (var i in _Data.Type) %7B%0A                _sounds_conherent%5B_Data.Type%5Bi%5D%5D = %7B%7D;%0A            %7D%0A
         %7D;%0A     

Edit sound structure