「Module:StorySim」:修訂間差異

增加 947 位元組 、​ 2023年12月22日 (星期五)
無編輯摘要
無編輯摘要
SSF留言 | 貢獻
無編輯摘要
第78行: 第78行:


        self.curCNode = n:tag('td'):wikitext(txt);
        self.curCNode = n:tag('td'):wikitext(txt);
       if name=='' then self.curCNode:addClass('thinking');end
        return self;
        return self;
      end;
      end;
第97行: 第98行:
    ['FullscreenImportant'] = {-- FullscreenImportant
    ['FullscreenImportant'] = {-- FullscreenImportant
      WriteLine = function(self,txt,_)
      WriteLine = function(self,txt,_)
        self.curCNode = self.curNode:tag('div'):wikitext(txt);
        self.curCNode = self.curNode:wikitext(txt);
        return self;end;
        return self;end;
      AppendLine = _generic_AppendLine,
      AppendLine = _generic_AppendLine,
第104行: 第105行:
    ['CgDialog'] = {-- CgDialog TBD
    ['CgDialog'] = {-- CgDialog TBD
      WriteLine = function(self,txt,name)
      WriteLine = function(self,txt,name)
        local N = self.curNode:tag('div');
        local N = self.curNode:tag('div'):addClass('DialogChild');
        local n = N:tag('div');writeCName(n,name);
        if name ~= '' then local n = N:tag('div');writeCName(n,name);end
        self.curCNode = N:tag('div'):wikitext(txt);
        self.curCNode = N:tag('div'):wikitext(txt);
       if name == '' then self.curCNode:addClass('thinking');end
        return self;
        return self;
      end;
      end;
第112行: 第114行:
      Reset = _generic_Reset
      Reset = _generic_Reset
    },
    },
    ['ChapterTitle'] = {-- Novel
    ['ChapterTitle'] = {-- CT
      WriteLine = function(self,txt,_)
      WriteLine = function(self,txt,_)
        self.curCNode = self.curNode:tag('div'):wikitext(txt);
        self.curCNode = self.curNode:wikitext(txt);
        return self;
        return self;
      end;
      end;
第158行: 第160行:
]]
]]


local function reco(str)
   while true do
     local s,e,c,t = string.find(str,'<color=(.-)>(.-)</color>');
     if s then str = string.sub(str,1,s-1) .. "<span class='Colored color_" .. c .. "' style='color:" .. c .. ";'>" .. t .. "</span>" .. string.sub(str,e+1)
     else break;
     end
   end
   while true do
     local s,e,c,t = string.find(str,'<size=(.-)>(.-)</size>');
     if s then str = string.sub(str,1,s-1) .. string.format("<span class='Sized size_%s' style='font-size:%.3fem;'>",c,(tonumber(c)/36)) .. t .. "</span>" .. string.sub(str,e+1)
     else break;
     end
   end
   return str;
end


-- Start --
-- Start --
第179行: 第196行:
    local cPID = 'Dialogue';
    local cPID = 'Dialogue';
    if d[1][1] == 0 then cPID = d[1][2];end
    if d[1][1] == 0 then cPID = d[1][2];end
    local currentPrinter = createPrinter(box,cPID);
    local currentPrinter;
    cPID = nil;
    local lastName = '';
 
    local canAppend = false;
    local canAppend = false;
    local _i = 0;
    -- local _i = 0;
    for _, t in ipairs(d) do
    for _, t in ipairs(d) do
      _i = _i + 1;
      -- _i = _i + 1;
      if t[1] == 0 and _i ~= 1 then currentPrinter=createPrinter(box,t[2]); canAppend=false;
      if t[1] == 0 then
       cPID = t[2];
       currentPrinter=nil;
       canAppend=false;
      elseif t[1] == 1 then
      elseif t[1] == 1 then
        if canAppend then currentPrinter:AppendLine(t[2]);
       if not currentPrinter then currentPrinter = createPrinter(box,cPID);end
        else currentPrinter:WriteLine(t[2],t[3]);
        if canAppend and t[3] == lastName then currentPrinter:AppendLine(reco(t[2] or ''));
        else currentPrinter:WriteLine(reco(t[2] or ''),t[3]);lastName = t[3];
        end;canAppend=nil;
        end;canAppend=nil;
      elseif t[1] == 2 then
      elseif t[1] == 2 then
第202行: 第222行:
        currentPrinter:Reset();
        currentPrinter:Reset();
      elseif t[1] == 6 then
      elseif t[1] == 6 then
        if t[3] == '' then asmCNames[t[2]] = nil
        if t[2] == '' then asmCNames[t[3]] = nil
        else asmCNames[t[3]] = t[2]
        else asmCNames[t[3]] = t[2]
        end
        end
WikiBuilder
329

次編輯